Skip to content
Skillpedia
Websites & UI (frontend)75k · #2807

dark-mode-css

What it does

This skill adds a dark version of a website's colours. It is for developers who want their site to look comfortable at night and respect device settings.

When to use it

  • ✓When your visitors ask for a dark theme for reading at night.
  • ✓When your site has fixed colours that look wrong on a dark background.
  • ✓When you want the site to follow each visitor's light or dark device setting.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/dark-mode-css/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/dark-mode-css/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you add dark mode to my website that follows the system setting?”

5 new skills a week. 1 minute to read.

How it works

The agent moves colours into named values and sets different ones for dark mode. It can also add a switch so visitors can choose their own theme.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Support dark mode with prefers-color-scheme

More than half of users prefer dark mode for reduced eye strain, especially in low-light environments. Users with photosensitivity rely on it. Implementing dark mode via prefers-color-scheme respects the user's OS preference without them needing to find a toggle, and CSS custom properties make it a clean, maintainable addition rather than a disruptive refactor.

Quick Reference

  • Use @media (prefers-color-scheme: dark) to apply dark mode styles
  • Define light/dark colors as CSS custom properties on :root for easy switching
  • Support a manual toggle by storing preference in localStorage and setting a data-theme attribute
  • Ensure dark mode colors maintain WCAG contrast ratios

Check

Check if this CSS supports dark mode. Look for prefers-color-scheme usage or a data-theme attribute pattern. Identify any hard-coded colors that would look wrong in dark mode.

Fix

Implement dark mode by extracting colors to CSS custom properties and redefining them inside a prefers-color-scheme: dark media query.

Explain

Explain how to implement dark mode with CSS custom properties, the prefers-color-scheme media query, and a JavaScript toggle for user preference.

Code Review

Review stylesheets, component styles, and responsive states related to Support dark mode with prefers-color-scheme. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/dark-mode-css

FAQ

How does the site know the visitor wants dark mode?

The browser reports the device setting, and the page uses it to choose dark colours automatically.

Can visitors pick a theme themselves?

Yes. The skill describes a manual switch whose choice is saved in the browser.

Will text stay readable in dark mode?

The skill says to keep contrast high enough to meet accessibility standards for text.

Details

Original description by the author

Use when reviewing stylesheets, component styles, and responsive behavior related to Support dark mode with prefers-color-scheme. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2807
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills