Frontend Theming Dark Light Mode

Use when adding dark mode to a website or app, choosing between system-followed-only and user-toggle modes, eliminating duplicated `@media (prefers-color-scheme: dark) { ... }` rules with `light-dark()`, fixing a white flash on reload (FOUC), getting scrollbars and native form controls (`<input type="checkbox">`, `<input type="date">`, `<select>`) to render in dark theme, persisting a user theme choice across reloads, or building a three-state toggle (system / light / dark). Use when reviewing a dark mode that already exists and assessing whether it covers all the cases below. Prevents the six dominant dark-mode failures : using `light-dark()` without declaring `color-scheme: light dark` on `:root` (always returns the light value), forgetting `color-scheme` entirely so the page background goes dark but scrollbars and checkboxes stay light, applying the theme via `useEffect` AFTER first paint causing a white flash on every reload, duplicating every rule in `@media (prefers-color-scheme: dark)` instead of using

Impertio-Studio 282d8ca 4 files · 37.2 KB Updated

File contents

impertio-studio/frontend-design-claude-skill-package/tree/main/skills/source/frontend-theming/frontend-theming-dark-light-mode commit 282d8ca4fb

Frequently asked questions

npx skillmds@latest add impertio-studio/frontend-theming-dark-light-mode