Overhaul Color Tokens Setup w/ Extended Button#373
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the design tokens and the Button component to enforce a strict semantic color system with component-scoped aliases. The Button component now uses predefined variant and tone props instead of inline color schemes. Two critical issues were identified in the review: a self-referential "transparent" alias in colors.json that causes infinite recursion during the build process, and a missing aria-label on an icon-only Button in control.tsx that leads to a TypeScript compilation error.
nick-nlb
left a comment
There was a problem hiding this comment.
Thanks Paolo! The refactoring of the theme looks great (as does the reworking of the button variants).. I like the separation of token layers the overall refactor introduces.
One comment to address but approved.
| for (const name of Object.keys(COLOR_MAP)) { | ||
| const constName = name.includes('-') ? `'${name}'` : name; | ||
| lines.push(` ${constName}: '${values.join(', ')}',`); | ||
| lines.push(` ${constName}: '${toCssChannels(resolveChannels(name))}',`); |
There was a problem hiding this comment.
Differently to the CSS version, this one resolves to the actual color rather than the name. So where the CSS file has:
` ``
--color-atlas-surface: var(--color-surface);
The TS file has
'atlas-surface': '247 252 255',
This means that if the partner overrides --color-surface, it will affect only CSS/SCSS but not the TS versions. Let's make this resolve to the variable in the same way.
There was a problem hiding this comment.
Updated TS to resolve with shared consts for any inline values - let me know if this wasn't what you were intending?
Overview
Reworks the design-token system into a clear two-layer model and rebuilds the Button's color API on top of it.
Tokens (packages/tokens)
Button
Docs
Build
packages/tokens/dist/) is no longer committed — addedpackages/tokens/.gitignore(dist/) and a rootpreparescript(
pnpm run generate:tokens) so it's regenerated on install / build.New Buttons
Prompt and Status buttons before / after:
Export button before / after:
Everything else matches existing existing styles visually.