Skip to content

Instantly share code, notes, and snippets.

View felds's full-sized avatar
:shipit:

Luiz “Felds” Liscia felds

:shipit:
View GitHub Profile
@felds
felds / serializing.ts
Created October 6, 2023 23:13
Serializing/reviving objects in TS
class Point {
constructor(
public x: number,
public y: number,
) {}
serialize(): any {
return {__type: this.constructor.name, x: this.x, y: this.y}
}
toString() {
return `I'm a point: ${this.x}, ${this.y}`
@felds
felds / index.html
Created March 17, 2024 22:51
TODO rapidinho com a M
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<meta name="color-scheme" content="dark light">
<style>
* {
font-size: 32px;

Dark mode is not a feature — it’s a browser setting

It’s 2025, and we’re still building dark mode toggles with JavaScript like it’s 2019. This is a UX oversight. Mode preference — light or dark — is a personal, system-level setting, and browsers already know how to handle it. Yet, websites keep reinventing the wheel with janky toggles that often don’t persist, don’t sync with system changes, and can’t even influence CSS media queries. The result? Inconsistent UX, broken themes, and wasted developer time — all to replicate something that should be a native browser feature, just like zoom or autoplay controls.

There are plenty of practical and technical reasons why theme switching belongs in the browser, not in your app code. Here’s a breakdown of why this shift would be a win for users, developers, and the web platform as a whole:

1. Accessibility & UX Consistency

Native switches could be surfaced consistently across all sites, making them easier to find and use — especially for users relying on keyb