light-dark-mode

Solid

Load this skill whenever the project supports light/dark mode, colour theme switching, high-contrast mode, or responds to prefers-color-scheme. Under no circumstances hard-code colours that break in alternative themes. Absolutely always test colour contrast in both light and dark themes, and respect user OS-level colour preferences via CSS media queries.

AI & Automation 35 stars 2 forks Updated today AGPL-3.0

Install

View on GitHub

Quality Score: 79/100

Stars 20%
52
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Light/Dark Mode Accessibility Skill > **Canonical source**: `examples/LIGHT_DARK_MODE_ACCESSIBILITY_BEST_PRACTICES.md` in `mgifford/ACCESSIBILITY.md` > This skill is derived from that file. When in doubt, the example is authoritative. Apply these rules whenever implementing or reviewing colour theme support in HTML, CSS, or JavaScript. **Only load this skill if the project supports light/dark mode or user theme switching.** --- ## Critical Rule: Focus Is Navigation, Not Selection **A theme must not change until the user explicitly activates an option.** Moving keyboard focus or pointer hover across theme choices MUST NOT preview, select, or apply a theme. Tabbing across System, Light, and Dark MUST leave the page colours unchanged until the user presses Enter or Space. This is a **Critical** requirement. Violations cause colour flashing during keyboard navigation and disorient users with vestibular disorders, cognitive disabilities, and low vision. --- ## Core Mandate All colour themes **must** meet WCAG 2.2 Level AA contrast in **both** light and dark modes, including forced-colours / high contrast modes. Test all three — not just the default. ## Required: Three-Option Theme Selector Pattern Use a visible three-option selector that shows all three options at the same time: * System * Light * Dark ### Interaction pattern requirements * MUST use a labelled group containing three native `<button type="button">` elements * MUST use `aria-pressed="true"` for the ...

Details

Author
mgifford
Repository
mgifford/accessibility-skills
Created
4 months ago
Last Updated
today
Language
JavaScript
License
AGPL-3.0

Similar Skills

Semantically similar based on skill content — not just same category