agentleFS
UwayxtUwayxt/agent-skills/.agents/skills/dark-mode-theming-system/SKILL.md

dark-mode-theming-system

Skill4 starsChanged 3 months agoMITView on GitHub

Define dual-theme token layer and elevation models for light and dark mode. Use when dark mode, theme switching, color scheme, or dark theme.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before introducing dark theme values, verify that all components consume semantic tokens (color-surface, color-text-primary, …

    line 9
  2. Distinctive:

    Ensure state highlights (hover, active, focus) maintain clear delta without overwhelming the eye.

    line 28
  3. Distinctive:

    Ensure charts, badges, and status pills retain clear semantic meaning and pass contrast checks in both modes.

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dark mode is not an inverted color palette — it is a dedicated semantic surface hierarchy where elevation is communicated through surface lightness and border contrast rather than drop shadows.

1. Audit the primitive and semantic layers

Before introducing dark theme values, verify that all components consume semantic tokens (color-surface, color-text-primary, color-border-subtle), not raw hex or primitive tokens (gray-100, blue-500). Any hardcoded color will break when theme switches.

2. Establish the dark surface elevation scale

In light mode, elevation is communicated with drop shadows (box-shadow: 0 4px 12px ...). In dark mode, shadows are mostly invisible against dark backgrounds. Replace shadow depth with surface lightness:

  • color-surface-ground (Base/Canvas): #121212 or #0A0A0C (lowest luminance)
  • color-surface-base (Default container/card): #1E1E22 or #16161A
  • color-surface-elevated (Dropdowns, modals, popovers): #28282E or #222228
  • color-surface-highest (Tooltips, toasts, floating CTAs): #34343C or #2E2E36

3. Map text and icon contrast for dark backgrounds

Pure white (#FFFFFF) on pure black (#000000) causes visual halation and eye fatigue:

  • color-text-primary: #F0F0F3 (87–90% opacity white)
  • color-text-secondary: #A0A0AB (60–70% opacity white)
  • color-text-muted: #6E6E7A (38–45% opacity white)
  • color-border-subtle: rgba(255, 255, 255, 0.08) to rgba(255, 255, 255, 0.12)

4. Adjust brand and accent vibrancy

Saturated brand colors that work well on light backgrounds can vibrate or fail WCAG contrast on dark surfaces:

  • Desaturate primary accents by 10–20% or use a lighter tonal variant (e.g. blue-600 on light becomes blue-400 on dark) to meet WCAG 4.5:1 contrast against dark card surfaces.
  • Ensure state highlights (hover, active, focus) maintain clear delta without overwhelming the eye.

5. Define implementation and preference strategy

Support both explicit user toggle and OS preference:

  • CSS token switching via [data-theme="dark"] attribute on the root document element.
  • Auto-detect default with @media (prefers-color-scheme: dark) when user preference is unset.
  • Persist user choice in localStorage and prevent flash of unstyled theme (FOUT/theme flicker) with an inline blocking script in the <head>.
  • Set color-scheme: dark / color-scheme: light on html so native scrollbars, select dropdowns, and form inputs render with matching native browser chrome.

6. Audit images, illustrations, and third-party embeds

  • Invert or swap line-art icons and illustrations that rely on dark lines.
  • Lower the brightness or contrast of full-bleed photographs slightly (filter: brightness(0.85) contrast(1.1)) if they appear blinding in dark mode environments.
  • Ensure charts, badges, and status pills retain clear semantic meaning and pass contrast checks in both modes.

Completion Criteria

  • Base canvas and 3+ elevation surface tiers defined for dark theme
  • Text hierarchy defined without harsh pure white (#FFFFFF) on dark surfaces
  • Brand/accent colors adjusted for WCAG 2.1 AA contrast against dark surfaces
  • CSS custom properties architecture defined with [data-theme] and color-scheme
  • Theme switcher anti-flicker strategy documented for runtime implementation
  • Visual asset (illustrations, charts, images) dark mode strategy specified

Output

A complete dark-tokens.json schema and CSS tokens mapping covering all surface tiers, text roles, border contrasts, brand adjustments, and the root theme switching contract.

Anti-patterns

  • Inverting the light palette mathematically with filter: invert(1) (produces muddy colors and distorted photography).
  • Relying on pure black (#000000) for all cards and backgrounds (flattens visual hierarchy).
  • Using identical high-opacity drop shadows from light mode in dark mode (invisible against dark surfaces).
  • Forgetting to declare color-scheme: dark, causing blinding white native inputs or dropdowns.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.