Skip to content

Add missing success background and tint color tokens#43

Open
threepointone wants to merge 1 commit intomainfrom
fix-success-semantic-color-tokens
Open

Add missing success background and tint color tokens#43
threepointone wants to merge 1 commit intomainfrom
fix-success-semantic-color-tokens

Conversation

@threepointone
Copy link

Fixes #31

Summary

The success semantic color was incomplete compared to info, warning, and danger. Only --text-color-kumo-success existed -- there were no --color-kumo-success or --color-kumo-success-tint tokens, which meant Tailwind utilities like bg-kumo-success, border-kumo-success, and bg-kumo-success-tint didn't resolve. Any success-state UI had to fall back to raw Tailwind green utilities, which don't respect the Kumo theme system.

How this was built

This PR was authored with an AI agent (Claude) in Cursor. Here's the workflow:

  1. "I'm working on this issue -- analyse this repository and recommend next steps" -- The agent explored theme-kumo.css, the theme generator config, kumo-binding.css, the Figma plugin mappings, and searched for raw green color workarounds across the codebase. It identified the gap, mapped out the token pattern used by the other semantic colors, found the MeterDemo workaround using green-500, and proposed concrete next steps.

  2. "Let's plan it. I'd also like to handle dark mode" -- The agent produced a detailed plan covering the exact oklch values to use (derived from the Tailwind v4 default green palette), all files that needed updating, and the dark mode fix for the existing text token. I reviewed and approved the plan.

  3. "Implement the plan" -- The agent executed each step: edited the theme generator config, ran pnpm codegen to regenerate theme-kumo.css, updated the Figma plugin mappings, fixed the MeterDemo workaround, and created the changeset.

What changed and why

Theme generator config (packages/kumo/scripts/theme-generator/config.ts):

  • Added kumo-success (background) token: green-500 light / green-700 dark -- follows the exact same shade pattern as kumo-info (blue-500/700), kumo-warning (yellow-500/700), and kumo-danger (red-500/700).
  • Added kumo-success-tint token: green-300 light / green-900 dark -- same pattern as kumo-info-tint (blue-300/900), kumo-warning-tint (yellow-300/900), kumo-danger-tint (red-300/900).
  • Fixed text-kumo-success dark mode: changed from green-500 to green-400. The original used the same value for both light and dark, which was inconsistent with every other status text token (danger uses red-500/400, warning uses yellow-800/400, link uses blue-800/400). The lighter green-400 improves readability on dark backgrounds.

Generated theme CSS (packages/kumo/src/styles/theme-kumo.css):

  • Regenerated by pnpm codegen to include the new --color-kumo-success and --color-kumo-success-tint CSS custom properties with light-dark().

Figma plugin (packages/kumo-figma/src/parsers/tailwind-to-figma.ts, packages/kumo-figma/src/generators/shared.ts):

  • Added bg-kumo-success, bg-kumo-success-tint, and border-kumo-success to the Tailwind-to-Figma color mapping so the Figma plugin can resolve these new tokens.
  • Added success and successTint to the shared VAR_NAMES object for use in generators.

MeterDemo (packages/kumo-docs-astro/src/components/demos/MeterDemo.tsx):

  • Replaced from-green-500 via-green-500 to-green-500 with from-kumo-success via-kumo-success to-kumo-success. This was a workaround for the missing token and is now the only raw green usage found in the codebase.

Token parity (before/after)

Token level info warning danger success (before) success (after)
--text-color-kumo-* blue-800/400 yellow-800/400 red-500/400 green-500/500 green-500/400
--color-kumo-* blue-500/700 yellow-500/700 red-500/700 -- green-500/700
--color-kumo-*-tint blue-300/900 yellow-300/900 red-300/900 -- green-300/900

Notes to reviewers

  • The oklch values for the new tokens come directly from the Tailwind CSS v4 default green palette. No custom colors were invented.
  • The shade selection (500/700 for background, 300/900 for tint) follows the exact pattern established by the existing info, warning, and danger tokens -- no design decisions were made outside of that precedent.
  • The dark mode fix for the text token (green-500 to green-400) is a minor contrast improvement. If you'd prefer to keep it as-is and scope this PR strictly to the missing background/tint tokens, that line is easy to revert independently.
  • The FedRAMP theme (theme-fedramp.css) does not currently override any status color tokens, so no changes were needed there. If FedRAMP needs custom success colors in the future, they can be added to the fedramp key in the theme generator config.
  • After merging, any component that was previously forced to use raw green-* classes for success states can be migrated to bg-kumo-success, border-kumo-success, or bg-kumo-success-tint.

Add missing `success` semantic tokens and mappings for parity with info/warning/danger. Includes: a changeset, new CSS variables (`--color-kumo-success`, `--color-kumo-success-tint`), update to `--text-color-kumo-success` dark value (use green-400 for better contrast), theme-generator config entries for kumo-success and kumo-success-tint, Figma generator/ parser mappings, and update Meter demo to use the `kumo-success` utility classes.
kumo: {
light: "var(--color-green-500, oklch(72.3% 0.219 149.579))",
dark: "var(--color-green-500, oklch(72.3% 0.219 149.579))",
dark: "var(--color-green-400, oklch(79.2% 0.209 151.711))",
Copy link
Author

@threepointone threepointone Feb 8, 2026

Choose a reason for hiding this comment

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

please note this specific change, reasoning in the pr description

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.

Missing success background and tint color tokens (only text token exists)

1 participant