agentleFS
botirkhaltaevbotirkhaltaev/botir-skills/skills/dark-mode-design/SKILL.md

dark-mode-design

Skill4 starsChanged 3 months agoApache-2.0View on GitHub

Implement dark mode as a first-class citizen, not an afterthought. Covers elevation through luminance, surface hierarchy, color adaptation, image handling, and token architecture for multi-mode design systems. Use when implementing dark mode, defining dark theme tokens, or testing dark themes. Triggers on: "dark mode", "dark theme", "elevation", "night mode", "theme switching", "dark UI", "OLED design".

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 2

    Distinctive

    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. Distinctive:

    No room for elevation hierarchy

    line 39
  2. Distinctive:

    Test all brand colors on dark surfaces

    line 49
  3. Very specific:

    Always default to prefers-color-scheme, with optional manual override:

    line 112

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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 Design

Dark mode is not light mode inverted. It's a distinct design that requires its own surface hierarchy, color logic, and testing approach.

The Core Principle: Elevation Through Luminance

On light backgrounds, elevation is shown with shadows (darker = higher). On dark backgrounds, shadows don't read. Instead, elevated surfaces get lighter.

Elevation LevelLight ModeDark Mode
Base#FFFFFF#121212
Surface (cards)#FFFFFF + shadow#1E1E1E
Raised (dropdowns)#FFFFFF + larger shadow#272727
Overlay (modals)#FFFFFF + backdrop blur#323232

Surface Tokens (Minimum 4 Levels)

dark/surface/base      = #121212  (deepest, page background)
dark/surface/raised    = #1E1E1E  (cards, panels)
dark/surface/elevated  = #272727  (dropdowns, menus, hover)
dark/surface/overlay   = #323232  (modals, dialogs, tooltips)

Never Use Pure Black

Pure black (#000000) causes:

  • Excessive contrast with white text (halation effect)
  • No room for elevation hierarchy
  • Lost depth cues on OLED (true black = off = no shadow visible)

Use #121212 to #1E1E1E as base.

Color Adaptation

Brand Colors

  • Desaturate by 10-20% for dark surfaces (fully saturated colors vibrate)
  • Lighten primary for better contrast on dark backgrounds
  • Test all brand colors on dark surfaces

Semantic Colors

IntentLight ModeDark Mode
Error#D32F2F#EF5350 (lighter for visibility)
Warning#F9A825#FFD54F
Success#388E3C#66BB6A

Text Colors

  • Primary text: #E0E0E0 (87% white, not pure white)
  • Secondary text: #A0A0A0 (60% white)
  • Disabled text: #6E6E6E (38% white)
  • Pure white (#FFFFFF): reserved for emphasis only

Image & Media Handling

ElementTreatment
PhotosSlight brightness reduction or subtle overlay to prevent harsh contrast
Transparent PNGsAdd subtle background behind dark-on-transparent assets
SVG iconsUse currentColor so they adapt automatically
IllustrationsProvide dark-mode variants or apply brightness filter

Shadow Replacement

On dark backgrounds, replace shadows with:

Instead of...Use...
box-shadow: 0 2px 4px rgba(0,0,0,0.2)Lighter surface color + subtle border
Large drop shadowsSurface color change + 1px border in rgba(255,255,255,0.05)
Inner shadowsSlightly darker tint on the surface

Implementation Architecture

CSS Custom Properties Approach

:root {
  --surface-base: #FFFFFF;
  --surface-raised: #FFFFFF;
  --text-primary: rgba(0, 0, 0, 0.87);
  /* shadows for light mode */
}

[data-theme="dark"] {
  --surface-base: #121212;
  --surface-raised: #1E1E1E;
  --text-primary: rgba(255, 255, 255, 0.87);
  /* borders instead of shadows */
}

Tailwind CSS

// tailwind.config.js
module.exports = {
  darkMode: 'class', // or 'media'
  // dark: prefix works automatically
}

Respecting System Preference

Always default to prefers-color-scheme, with optional manual override:

  1. Check prefers-color-scheme: dark
  2. Allow user toggle (stored in localStorage)
  3. Apply theme class before render to prevent flash

Testing Checklist

  • All text meets WCAG AA on dark surfaces (4.5:1 for body)
  • All interactive states visible (hover, focus, active, disabled)
  • No pure black backgrounds (#000000)
  • Images don't become invisible or harsh
  • Shadows replaced with borders/surface changes
  • Tested on OLED and LCD screens
  • Tested with color blindness simulators
  • Smooth theme transition (no jarring flash)
  • Third-party embeds handled (may need overrides)

Reference Map

  • references/surface-token-map.md — luminance elevation ladder, text opacity, shadow swaps
  • references/contrast-adaptation.md — WCAG 2.2 contrast QA and brand/media adaptation

Related Skills

  • For design tokens → use design-systems
  • For color and contrast → use ui-visual-design
  • For accessibility testing → use a11y-accessibility-design

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.