dark-mode

Implement dark mode with semantic color tokens, CSS variables, and system preference detection.

38|3|Updated Dec 29, 2025
One-click install
npx skills add https://github.com/dylantarre/design-system-skills --skill dark-mode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dark-mode
Source: https://github.com/dylantarre/design-system-skills/tree/main/skills/patterns/dark-mode
Command: npx skills add https://github.com/dylantarre/design-system-skills --skill dark-mode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps teams implement a robust, accessible dark mode by leveraging semantic color tokens, CSS variables, and system preference detection. It enables consistent theming across projects and frameworks.

Core Features & Use Cases

  • Semantic tokens layer: primitive, semantic, and theme tokens to support light/dark modes.
  • Theme switching & persistence: user-driven toggles with localStorage persistence and graceful fallbacks.
  • System preference detection: respects prefers-color-scheme and adapts on system changes across frameworks.
  • Accessibility considerations: ensures contrast, focus rings, and motion preferences are respected.
  • Use Case: add dark mode to a design system and automatically switch based on user/system preferences.

Quick Start

Use the dark-mode skill to bootstrap a system that toggles themes based on system preference and a user action, using semantic tokens and CSS variables.

Frequently Asked Questions about dark-mode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement dark mode with semantic tokens and CSS variables?

Implement dark mode using semantic tokens by structuring your design system into primitive, semantic, and theme token layers mapped to CSS variables, allowing consistent light and dark theming across web apps and frameworks.

How do I detect system color scheme preferences for theme switching?

Detect system color scheme preferences using the prefers-color-scheme media query to automatically adapt your application's theme, while also listening for system changes to update the UI dynamically across different frameworks.

What is the best way to persist user dark mode preferences with localStorage?

Persist user dark mode preferences by saving their theme selection to localStorage, enabling user-driven toggles to override system preferences and maintaining the chosen theme across sessions with graceful fallbacks.

Does dark mode require special accessibility considerations for contrast and focus?

Dark mode requires accessibility considerations to ensure proper color contrast, visible focus rings, and respect for reduced motion preferences, guaranteeing that semantic tokens maintain readable UI standards in both light and dark themes.

Can I use semantic color tokens to support both light and dark modes in a design system?

You can use semantic color tokens to support both light and dark modes by mapping primitive colors to semantic roles, which then map to specific theme tokens, creating a scalable theming architecture across projects.

Why does my theme switching not respect the prefers-color-scheme media query?

Theme switching fails to respect prefers-color-scheme when system preference detection is not properly wired to update semantic tokens, requiring a system that actively listens for media query changes and updates CSS variables accordingly.