Repository navigation
feat(elements): light and dark color schemes - #287
Merged
Merged
Conversation
blunckr-aj
approved these changes
Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also fix non-base schemes resolving without the base scheme's values: scheme blocks layer on top of the base block in CSS, so their resolved maps now do too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…orScheme Co-Authored-By: Claude Opus 5.5 <[email protected]>
…docs site Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cheme Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Selected chip text uses text-clr-on-accent (was dark on dark in dark) - Info banner icon gets an info-clr-icon token readable in both schemes - Invalid calendar cell uses error-clr-fill with on-accent text - Scope every part of a cssVarsSelector list to the scheme, so dark values are never applied unconditionally - Accept base themes without sharedVariables/colorSchemes - Contrast tests cover component token pairs and banner icons Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces the docs-theme switch: the overview page keeps Storybook's own theme and only the .docs-story preview boxes take the scheme's background and text color. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dark background-clr-hover matched background-clr-raised (neutral800), so menu and listbox items showed no hover. Use neutral700 and test that hover/active surfaces differ from what they sit on in every scheme. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Section titles were an inline span (vertical margins ignored) in light grey regular text, so they read like disabled items. Make them small bold uppercase headings in text-clr-secondary, matching ListBox, and drop the now-unused text-clr-tertiary token. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The addon wrote every documented variable onto the docs page <body> as inline styles (and restored saved values from local storage), which pinned them over the active color scheme on overview pages. Show the same data with Storybook's ArgsTable instead, read-only, and remove the addon. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Matches the old addon, which rendered the table without a heading. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also keeps the "CSS Variables" subheading and drops unused imports. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Like the semantic token baseline it only guarded the migration; the contrast tests cover the values that matter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ElementsProvider keeps the same props and renders ColorSchemeProvider, which owns scheme resolution, the <html> attribute, the nested and duplicate-provider rules and useColorScheme. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o own files Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
onColorSchemeChange now fires only when the scheme actually changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every theme comes from createTheme, which always sets sharedVariables and colorSchemes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…heme helpers Variables always live on :root. The prefix never worked because components read unprefixed variable names. Also drop Theme.getVarName and per-scheme resolvedVariables, which only tests used. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r shared variables light always exists and applies when no scheme is selected, so the first-scheme fallback and Theme.baseColorScheme go. A theme's shared variables no longer override its base theme's scheme values: color overrides belong under colorSchemes.light / .dark. Docs and changeset call out the change for custom themes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Share one alias pattern between toCssValue and the alias check - Rename ResolvedColorScheme to ColorScheme and reuse it internally - Document what each Theme variable map is for - The :root block is always color-scheme: light - Fix the 'default-valu' typo; Prettier formatting Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and isToken Theme.variables now holds the shared tokens (was sharedVariables). isToken() replaces the every-token map for the $color/$bg props. getVar, getVarValue and resolvedVariables are gone: callers write var(--name) directly and the Storybook generator resolves defaults itself (output unchanged). Co-Authored-By: Claude Opus 5.5 <[email protected]>
seanrcollings
force-pushed
the
feat/color-schemes
branch
from
November 20, 2026 17:34
432bc73 to
b34db41
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds named color schemes to atomic-elements and ships a dark scheme alongside today's light look. Apps stay light unless they opt in. Ships as a minor release.
Using it
The provider sets
data-color-schemeon<html>, and the theme's CSS variables switch. The library doesn't store the user's choice; apps passcolorScheme+onColorSchemeChange(ordefaultColorScheme). Docs:packages/atomic-elements/docs/Theme/ColorSchemes.mdx.What changed
createThemetakescolorSchemes.modeand only the tokens it overrides.light(or the first scheme) is the base. Other schemes emit[data-color-scheme="x"]blocks on top of it.variableswin over a base theme's scheme values, so existing themes keep working in dark.Themefields:baseColorScheme,colorSchemes.defaultTheme: semantic tokens move into alightscheme (values unchanged), and a newdarkscheme overrides them.ElementsProvidergainscolorScheme,defaultColorSchemeandonColorSchemeChange."system"follows the OS setting live.applyDefaultStyles, the page background follows non-light schemes. Light pages are unchanged.useColorScheme()hook.accent-clr-fill,{error,warning,success}-clr-filland their-hovervariants. Buttons, selected items and checked controls use them. Same shades in light.info-clr-iconfor the info banner icon.background-clr-disabledfor disabled tabs.@ljcl/storybook-addon-csspropsaddon is replaced by a read-only CSS Variables table. The addon wrote saved values onto the page<body>, which pinned them over the dark scheme.ElementsProviderat the Docusaurus root (docs/src/theme/Root.tsx), replacing one per example.Tests
theme.spec.ts::root, a custom selector and selector lists;modeand for unknown token references.contrast.spec.ts: WCAG AA in every scheme for the text/background pairs components render, including chips, checkboxes, calendar, tooltip and banner icons.semantic.spec.ts:ElementsProvider.spec.tsx/colorScheme.spec.ts:"system"switching;Please check in Storybook (toolbar → Dark)
Chip (selected), Banner (all variants), Calendar (selected and invalid dates), Menu and Select (hover, section titles), Tabs (disabled), Table, Tooltip, Modal, ScrollArea. The dark values and a light/dark contrast table for every pair are in
docs/superpowers/plans/2026-11-19-color-schemes-visual-changes.md.Light-mode changes
error600(waserror800).error700with white text (waserror600with dark text). Contrast goes from 3.05:1 to 6.41:1.Known limitations
accent-clronly in sharedvariableskeeps the library's dark fill on buttons in dark. The docs say to set accent colors per scheme."system"on server-rendered pages, the first paint can briefly be light.🤖 Generated with Claude Code