dark-mode
/dark-mode
Implement dark mode that honors system preference, allows manual override, and never flashes the wrong theme. Use when adding dark mode or fixing its flash, contrast, or image problems.
- Author
- Amey-Thakur ↗
- Repository
- AI-SKILLS ↗
- Licence
- MIT
- Last repository change
- 05.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Implement dark mode that honors system preference, allows manual override, and never flashes the wrong theme. Use when adding dark mode or fixing its flash, contrast, or image problems.
Original author description
Implement dark mode that honors system preference, allows manual override, and never flashes the wrong theme. Use when adding dark mode or fixing its flash, contrast, or image problems.
How it works
- Method
- Boundaries
SKILL.md preview
--- name: dark-mode description: Implement dark mode that honors system preference, allows manual override, and never flashes the wrong theme. Use when adding dark mode or fixing its flash, contrast, or image problems. --- # Dark mode Dark mode is a second design, not an inverted one. The mechanics are simple; the craft is in the handoff between system preference, user override, and first paint. ## Method 1. **Three-state preference: light, dark, system.** Default to system via `prefers-color-scheme`; store an explicit user choice (localStorage) only when they pick one, and keep following the OS when they chose "system". Listen for `change` on the media query so the app flips live at sunset. 2. **Kill the flash at first paint.** A tiny inline script in `<head>` reads the stored choice and stamps `data-theme` on `<html>` before any CSS applies. Also declare `color-scheme: light dark` so scrollbars, inputs, and default backgrounds render natively correct. 3. **Retune, do not invert.** Dark surfaces are dark gray (not black), elevation becomes lighter-surface instead of shadow, saturated brand colors need desaturating or lightening to hold contrast on dark. Run the contrast pass separately for each theme; 4.5:1 failures cluster in dark mode's muted text. 4. **Route it through tokens.** Only semantic custom properties change per theme (see css-theming); component CSS never mentions the theme. If you find `[data-theme="dark"] .card` in a component file, the token layer is missing a role. 5. **Handle images and media.** Dim photos slightly (`filter: brightness(.9)`) if they glare; swap logos with `<picture media="(prefers-color-scheme: dark)">` or a masked SVG using `currentColor`; keep `color-scheme` off embedded iframes you do not control. 6. **Test the forgotten surfaces.** Focus rings, selection color, placeholder text, disabled states, charts, and email/PDF exports; each has a default that betrays the theme. ## Boundaries - Auto-darkening user-generated content (documents, embedded HTML) can destroy meaning; scope the theme to your chrome and leave content opt-in. - `forced-colors: active` (Windows High Contrast) overrides both your themes; respect it rather than fighting it. - A dark mode toggle in a cookie-consent-style banner is noise; put it in settings and remember it.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Amey-Thakur/AI-SKILLS | 90 | MIT |
| FrancoStino/opencode-skills-collection | 100 | MIT |
| sickn33/agentic-awesome-skills | 100 | MIT |
| dresar/ui-skill-2045 | 100 | MIT |
| egregore-labs/egregore | 100 | MIT |
| arnavpuri/designskills | 100 | MIT |
| egregore-labs/egregore | 86 | MIT |
Database snapshot: 13.11.2026 · package version 49e4f5d39ffa (SHA-256 digest of the entire package)
Downloads in the last 30 days: 3 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90dark-mode-implementation
Use when implementing dark mode — prefers-color-scheme detection, theme persistence, flash-of-unstyled-theme prevention, color token mirroring, image and asset variants, and meta theme-color updates. Do NOT use for designing the dark palette itself, designing the token… - 100theming
Apply colour scheme, dark mode, and theme tokens in React Native. Use when adding a theme, supporting dark mode, or replacing hardcoded colours. - 100dark-mode-design
Build a dark theme with correct elevation, surface hierarchy, and contrast. Use when adding dark mode to a product, or when an existing dark theme looks flat, muddy or hard to read. - 100adaptive-dark-mode
Audit a website's theming and make it ready for Safari's Adaptive Dark Mode (Safari 27.3+), which automatically darkens light sites that don't declare dark-mode support. Use this whenever the user mentions Adaptive Dark Mode, Safari's automatic or forced dark mode,… - 100frontend-ui-dark-ts
Builds dark-themed TypeScript UIs with accessible color systems, contrast compliance, and responsive design patterns. Use when implementing dark mode or building accessible TypeScript UI components. - 100theming
Use when building a theme or theming system for an interface. Covers token architecture, dark mode, contrast preservation across themes, and generating a coherent palette from a seed colour. Trigger on "add dark mode", "contrast breaks in dark mode", "white-label this app",…