Skip to content

fix: severity overrides and colors - #5239

Merged
mimarz merged 24 commits into
chore-fix-color-scale-weaknessfrom
fix-severity-colors-generation
Aug 26, 2026
Merged

fix: severity overrides and colors#5239
mimarz merged 24 commits into
chore-fix-color-scale-weaknessfrom
fix-severity-colors-generation

Conversation

@mimarz

@mimarz mimarz commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Found this bug when testing different config permutations during plugin work (and with example of how Kartverket had defined their config).

  • Fixes a bug in cli color generation where severity colors defined colors were overwritten by defaults.
  • Simplified color-scheme generation to better handle overrides.
  • Removed use of index lookup for default colors and juggling between working data model, moving conversion to tokens at the very end.
  • Fixed addSeverityColors so that severity colors are always last as this is wanted by designers in Token Studio and Figma Variables.
  • Folded chore(cli): add tests #5245 and chore: simplify color-scheme tokens generation #5256 into this PR as chore: simplify color-scheme tokens generation #5256 ended up changing a lot of the same code as this PR. Unfortunate side-effect for a lot of test files also included in this PR.

Stack created with GitHub Stacks CLIGive Feedback 💬

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e7e873c

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

This PR includes changesets to release 5 packages
Name Type
@digdir/designsystemet Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-types Patch
@digdir/designsystemet-react Patch
@digdir/designsystemet-web Patch

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

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Preview deployments for this pull request:

storybook - 25. Aug 2026 - 14:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes CLI color generation so custom severity colors and overrides are preserved.

Changes:

  • Preserves user-defined severity colors when adding defaults.
  • Simplifies color-scheme generation and override merging.
  • Adds a patch changeset.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/cli/src/tokens/utils.ts Preserves custom severity colors.
packages/cli/src/tokens/create/generators/primitives/color-scheme.ts Unifies color-scale and override generation.
.changeset/eight-carrots-find.md Documents the patch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .changeset/eight-carrots-find.md Outdated
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch 2 times, most recently from fc106c5 to 1246dfc Compare August 20, 2026 08:15
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch from 1246dfc to 86e321c Compare August 20, 2026 10:21
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch from 86e321c to 42ef7e6 Compare August 20, 2026 11:53
Comment thread packages/cli/src/tokens/create/generators/primitives/color-scheme.ts Outdated
Comment thread .changeset/eight-carrots-find.md Outdated
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch from 42ef7e6 to 34c9e3a Compare August 24, 2026 06:28
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch from 34c9e3a to 51f7213 Compare August 24, 2026 09:21
@mimarz
mimarz requested a balanced review from Copilot August 24, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread packages/cli/src/tokens/utils.ts Outdated
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch 2 times, most recently from 6a278a7 to c06643a Compare August 24, 2026 10:54
@mimarz
mimarz force-pushed the fix-severity-colors-generation branch from c06643a to f0bec71 Compare August 24, 2026 11:39
@mimarz
mimarz requested review from Barsnes and eirikbacker and a balanced review from Copilot August 25, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread packages/cli/src/tokens/create/generators/primitives/color-scheme.test.ts Outdated
Comment thread packages/cli/src/tokens/utils.ts
mimarz and others added 2 commits August 25, 2026 13:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
result.set(name, userValue ?? value);
}
return result;
return Object.fromEntries(result) as Theme['colors'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice ☺️ though, returning an object re-introduces the issue - I was thinking to actually work with Map or tuples, as order is crucial in this project, but I guess that causes changes to a whole line of functions 😌

@mimarz mimarz Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Lets cross that bridge when we get there :)

@mimarz
mimarz merged commit 3ce23c5 into main Aug 26, 2026
20 checks passed
@mimarz
mimarz deleted the fix-severity-colors-generation branch August 26, 2026 08:44
@github-actions github-actions Bot mentioned this pull request Aug 26, 2026
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.

4 participants