feat: remove color categories#4917
Conversation
🦋 Changeset detectedLatest commit: 81a2f0b The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
|
Preview deployments for this pull request: storybook - themebuilder - www - |
There was a problem hiding this comment.
Pull request overview
This PR removes the main/support color category split, flattening custom theme colors into a single record so they sit alongside reserved colors (e.g. neutral). Token files, schema, generators, themebuilder UI, CLI plumbing, and tests are restructured accordingly. A new automigration is introduced to convert legacy colors.main / colors.support configs to the flat shape, and @inquirer/confirm is added to drive the interactive prompt.
Changes:
- Flatten
theme.colorsto a single record (nomain/support/neutralnesting); regeneratesemantic/color/<name>.jsonper color and drop thesemantic/modes/{main,support}-color/*token sets. - Add
flatten-color-categoriesautomigration plus acheckAutomigrateflow wired intodesignsystemet tokens create(with--skip-check/--yes); split config validation helpers out ofconfig.tsinto a versionedschemas/v1.1/schema.tsandschemas/helpers.ts. - Update Themebuilder URL/state model to a single
colorsquery param (with backwards-compat redirect frommain/support/neutral) and rework color pane / overrides / previews accordingly.
Reviewed changes
Copilot reviewed 90 out of 95 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/migrations/flatten-color-categories.ts | New automigration that flattens old main/support/neutral shape. |
| packages/cli/src/migrations/index.ts | Registers the new automigration. |
| packages/cli/src/automigrate.ts | New helper that detects and prompts for eligible migrations. |
| packages/cli/bin/designsystemet.ts | Wires checkAutomigrate, --skip-check/--yes options, switches to colorNames. |
| packages/cli/bin/config.ts | Updates legacy color flags to the flattened structure; uses new schema helpers. |
| packages/cli/src/schemas/v1.1/schema.ts | New v1.1 zod schema with flat colors. |
| packages/cli/src/schemas/v1/schema.ts | Reduced to schema-only (validation helpers extracted). |
| packages/cli/src/schemas/helpers.ts | New validateConfig/parseConfig helpers extracted from config.ts. |
| packages/cli/src/index.ts | Re-export switched to v1.1 schema. |
| packages/cli/src/scripts/createJsonSchema.ts | Imports from v1.1 schema. |
| packages/cli/src/tokens/types.ts | Imports ConfigSchemaTheme from v1.1 schema. |
| packages/cli/src/tokens/utils.ts | Replaces colorNamesByCategory with addSeverityColors / toColorNames. |
| packages/cli/src/tokens/format.ts | Uses toColorNames; passes colorNames into createTokens. |
| packages/cli/src/tokens/create.ts | Accepts colorNames, generates flat semantic/color/<name> sets. |
| packages/cli/src/tokens/create/files.ts | Threads colorNames through file generation. |
| packages/cli/src/tokens/create/generators/$themes.ts | Single Color group instead of Main color/Support color. |
| packages/cli/src/tokens/create/generators/$metadata.ts | Lists flat semantic/color/<name> paths. |
| packages/cli/src/tokens/create/generators/themes/theme.ts | Builds tokens from flat colorNames. |
| packages/cli/src/tokens/create/generators/semantic/color.ts | Emits a per-color TokenSet keyed by color name. |
| packages/cli/src/tokens/create/generators/semantic/style.ts | Inlines former semantic color tokens; restructures style output. |
| packages/cli/src/tokens/create/generators/semantic/color-modes.ts | Removed (no more main/support modes). |
| packages/cli/src/tokens/create/generators/primitives/color-scheme.ts | Generates color scales from flat colors record. |
| packages/cli/src/tokens/process/platform.ts | Adds 'color' to colorGroups. |
| packages/cli/src/tokens/process/output/declarations.ts | Splits severity vs custom colors when emitting .d.ts. |
| packages/cli/src/tokens/generate-config.ts | Replaces categorizeColors with flat extractColors. |
| packages/cli/src/scripts/update-preview-tokens.ts | Updated to new colorNames/flat colors API. |
| packages/cli/package.json | Adds @inquirer/confirm dep and ./schemas/* export. |
| packages/cli/tests/** | Test fixtures regenerated to flat color shape. |
| packages/css/theme/designsystemet.css | Reordered --ds-color-neutral-* and adds new top-level --ds-* vars; drops old data-color="brand1"/"brand2" mapping layers. |
| packages/react/stories/constants.tsx | Reads colors from flat config. |
| design-tokens/** | Token files restructured to flat semantic/color/* and updated $themes.json/$metadata.json. |
| designsystemet.config.json | Migrated to flat colors shape. |
| apps/themebuilder/** | URL state, color pane, overrides, previews, locales updated to the unified colors array (with legacy URL redirect). |
| pnpm-lock.yaml | Adds @inquirer/confirm and bumps node runtime to 24.16.0. |
| .changeset/*.md | Three changesets describing the changes. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a1e90e1 to
b98ca06
Compare
This reverts commit 65e3800.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
b98ca06 to
e4d3d0f
Compare
resolves #4934
TODO:
tokens buildstill has color-categories as it still works with both. Should we keep for backwards compatability?