Skip to content

feat: Update color palette for accessibility and show hex values in swatches#154

Merged
alexgrozav merged 2 commits intomainfrom
alexgrozav/color-a11y-story
Mar 23, 2026
Merged

feat: Update color palette for accessibility and show hex values in swatches#154
alexgrozav merged 2 commits intomainfrom
alexgrozav/color-a11y-story

Conversation

@alexgrozav
Copy link
Copy Markdown
Contributor

Revise base color values to use OKLCH-aligned accessible colors, remove per-color text-on tokens in favor of colorTextInverted, and display computed hex values in color swatch stories.

…watches

Revise base color values to use OKLCH-aligned accessible colors, remove
per-color text-on tokens in favor of colorTextInverted, and display
computed hex values in color swatch stories.
@alexgrozav alexgrozav self-assigned this Mar 23, 2026
@alexgrozav alexgrozav requested a review from Copilot March 23, 2026 21:00
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app-styleframe-dev-production Ready Ready Preview, Comment Mar 23, 2026 9:04pm
styleframe-dev-production Ready Ready Preview, Comment Mar 23, 2026 9:04pm
styleframe-storybook Ready Ready Preview, Comment Mar 23, 2026 9:04pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 23, 2026

🦋 Changeset detected

Latest commit: b489905

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@styleframe/theme Minor
styleframe Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alexgrozav alexgrozav merged commit 352f10c into main Mar 23, 2026
12 checks passed
@alexgrozav alexgrozav deleted the alexgrozav/color-a11y-story branch March 23, 2026 21:09
@github-actions github-actions bot mentioned this pull request Mar 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the theme’s base color palette to more accessible values (aligned to OKLCH targets), removes per-color text.on-* tokens in favor of a single inverted text token, and enhances Storybook color token swatches to display computed hex values and clearer token labels.

Changes:

  • Updated light/dark base color primitives and surface/background values in the theme palette.
  • Removed text.on-* token entries, consolidating inverted text handling.
  • Updated Storybook color swatches to show computed hex values in the preview and add color.<name> labels.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
theme/src/values/color.ts Updates base palette values and removes text.on-* token entries.
apps/storybook/src/components/design-tokens/colors/ColorSwatch.vue Computes and renders hex values for swatch backgrounds; adds token name label.
apps/storybook/src/components/design-tokens/colors/ColorSwatch.styleframe.ts Refactors swatch styling to use colorTextInverted and adds monospace name styling.
.changeset/accessible-color-palette.md Declares a minor release for the palette/swatches update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 173 to +190
// Base colors
primary: {
color: ref(colorTextOnPrimary),
background: ref(colorPrimary),
},
secondary: {
color: ref(colorTextOnSecondary),
background: ref(colorSecondary),
},
success: {
color: ref(colorTextOnSuccess),
background: ref(colorSuccess),
},
warning: {
color: ref(colorTextOnWarning),
background: ref(colorWarning),
},
danger: { color: ref(colorTextOnDanger), background: ref(colorDanger) },
info: { color: ref(colorTextOnInfo), background: ref(colorInfo) },
white: { background: ref(colorWhite) },
danger: { background: ref(colorDanger) },
info: { background: ref(colorInfo) },
white: { color: ref(colorBlack), background: ref(colorWhite) },
black: { color: ref(colorWhite), background: ref(colorBlack) },
gray: { color: ref(colorTextOnGray), background: ref(colorGray) },
gray: { background: ref(colorGray) },
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swatch preview now renders hexValue, but most color variants no longer set a foreground color (e.g., primary/secondary/success/warning/danger/info/gray). Since .color-swatch__preview has no default color, the text will inherit from the surrounding UI and can become unreadable on these backgrounds, and the contrast calculation will reflect the inherited color rather than the intended inverted text. Consider setting color: ref(colorTextInverted) for the base colored variants (and their tint/shade/interactive variants) and keeping explicit overrides for light backgrounds like white, background, and surface.

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +48
background: "#F8FAFC",
surface: "#FFFFFF",
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hex literals in this file are now a mix of uppercase and lowercase (e.g., background: "#F8FAFC" / surface: "#FFFFFF" vs white: "#ffffff"). It’d be easier to scan and less noisy in future diffs if the palette used a consistent casing for all hex values (pick one style and apply it across the file).

Copilot uses AI. Check for mistakes.
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