Skip to content

feat(elements): semantic color tokens - #286

Merged
seanrcollings merged 17 commits into
mainfrom
feat/semantic-color-tokens
Nov 20, 2026
Merged

seanrcollings merged 17 commits into
mainfrom
feat/semantic-color-tokens

Conversation

@seanrcollings

@seanrcollings seanrcollings commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Groundwork for color schemes (dark mode, high contrast). Components now use semantic color tokens (what a color is for) instead of raw palette shades, so a future scheme can remap colors without touching components. Ships as a minor release of @atomicjolt/atomic-elements (3.12.0).

What changed

  • Token files split into layers under src/styles/theme/: palette.ts (raw scales), foundations.ts (spacing, type, sizes), semantic.ts (roles like background-clr-subtle, text-clr-on-accent, border-clr-focus, error-clr-subtle, shadow-md), and component.ts (btn-bg-clr etc.). variables.ts and styles/theme.ts are gone; @styles/theme still works.
  • Every component reads semantic tokens only. No palette shades or hardcoded colors are left in component code.
  • Existing themes keep working.
    • Renamed tokens keep their old names as deprecated aliases. The new name references the old one, so overriding either reaches components.
    • Palette overrides still flow through.
    • Deprecated: background-clr-alt, text-clr-alt, border-clr-primary, outline-clr-primary, accent-clr-alt, {error,warning,success}-clr-alt, info-clr, info-clr-alt.
  • Changesets config: turned on onlyUpdatePeerDependentsWhenOutOfRange, so @atomicjolt/forms no longer gets a major release every time atomic-elements ships a minor that still satisfies its ^3.x peer range.
  • Docs: docs/Theme/Intro.mdx explains the token layers and lists the deprecated names. The design and plan are in docs/superpowers/.

Tests that guard this

  • layering.spec.ts fails if component code:
    • references a palette shade, a deprecated name or a hardcoded color;
    • redefines a semantic token locally;
    • reads a semantic token with a var() fallback, which can never apply.
  • semantic.spec.ts: overrides of palette shades, deprecated names, background-clr and outline-clr still reach the components that used them. Color props accept every name, and the types keep deprecated names out of SemanticColor.
  • During the migration, a temporary baseline test pinned every token's resolved value to prove nothing changed by accident. It has been removed now that the migration is done.

Visual changes to review in Storybook

Full list: docs/superpowers/plans/2026-11-19-semantic-tokens-visual-changes.md.

  • Floating-label inputs: the focus border is grey instead of teal, matching every other input.
  • Status chips: borders use palette 300 shades instead of hardcoded hex; warning chip text is slightly darker.
  • Error banner: the pressed close button matches hover (error800).
  • Inverted button: the hover shadow is neutral black.
  • Card tabs (disabled text) and disabled icons: use text-clr-disabled. Disabled icons are now opaque, so they no longer tint on colored backgrounds.
  • Calendar: selected-day text is pure white.

Danger and success buttons keep their 700/800 shades on purpose. White text on success600 fails WCAG AA (3.2:1).

Behavior change for custom themes

Components that used fixed shades now follow semantic tokens. So overriding a semantic token now reaches more components than before. For example:

  • toggles and menus follow accent-clr;
  • buttons, tables and tabs follow background-clr.

The changeset calls this out.

🤖 Generated with Claude Code

seanrcollings and others added 16 commits November 19, 2026 13:46
…antic and component layers

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… components

background-clr-raised now references background-clr and border-clr-focus
references outline-clr, so existing theme overrides still reach dropdowns
and focused input borders. Also skip array exports in the css-props
generator and document the wider reach of semantic overrides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stops changesets from releasing a major of @atomicjolt/forms every time
@atomicjolt/atomic-elements ships a minor that still satisfies its
^3.x peer range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The new semantic token `icon-clr` collided with MaterialIcon's optional
local hook `var(--icon-clr, inherit)`, so every icon turned neutral600
instead of inheriting its parent's color (e.g. banner icons). Rename the
semantic token to `icon-clr-secondary` and make the layering test fail
when a semantic token is read with a var() fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Solid fills behind on-accent text will be named *-fill across accent and
status colors in the color scheme work; rename before this ships so no
deprecated alias is needed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The resolved-token baseline, expectedChanges list and "today's shades"
test only guarded the migration itself. Keep the layering and
override-chain tests, which protect lasting guarantees. Also exclude
__tests__ helpers from the type build so they don't ship in dist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@seanrcollings
seanrcollings merged commit f5dd5e8 into main Nov 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants