Skip to content

chore: Refactor visual accent colors to use tokens - #4745

Merged
at-susie merged 10 commits into
mainfrom
dev-v3-onetheme-accent-update
Jul 27, 2026
Merged

chore: Refactor visual accent colors to use tokens#4745
at-susie merged 10 commits into
mainfrom
dev-v3-onetheme-accent-update

Conversation

@at-susie

@at-susie at-susie commented Jul 20, 2026

Copy link
Copy Markdown
Member

Description

This PR refactors the visual accent styling for the Box and Badge components.

Changes

  • Removed some unnecessary color options
  • Updated visual accent colors and badge component's style

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.62%. Comparing base (2b04fc3) to head (ac49215).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4745   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files         956      956           
  Lines       31004    31004           
  Branches    11410    11409    -1     
=======================================
  Hits        30269    30269           
- Misses        688      728   +40     
+ Partials       47        7   -40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@at-susie at-susie changed the title chore: Refactor visual accent colors to use explicit token references chore: Refactor visual accent colors to use tokens Jul 22, 2026
@at-susie
at-susie requested a review from georgylobko July 22, 2026 13:23
@at-susie
at-susie marked this pull request as ready for review July 22, 2026 13:23
@at-susie
at-susie requested a review from a team as a code owner July 22, 2026 13:23
Comment thread style-dictionary/one-theme/colors.ts Outdated
colorBackgroundBadgeBlue: { light: '{colorInfo100}', dark: 'rgba(92, 127, 255, 0.2)' },
colorBackgroundBadgeRed: { light: '{colorError100}', dark: 'rgba(255, 61, 61, 0.2)' },
colorBackgroundBadgeYellow: { light: '{colorWarning100}', dark: 'rgba(251, 211, 50, 0.2)' },
colorBackgroundBadgeGreen: { light: '{colorSuccess100}', dark: hexToRgba(paletteTokens.colorGreen500!, 0.2) },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to convert hex to rgba? We already have some tokens defined in hex, so why should these be different?

@at-susie at-susie Jul 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the visual-accent feature, we are introducing a quite a bit of semi-transparent colors that are all associated with primitive color palette like colorGreen500 with different opacity values. If we keep maintaining these only with the rgba it's error prone and hard to maintain. In think in the long term, other rgba values can also use the hexToRgba function for better maintainability.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's error prone and hard to maintain

why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We design those styles using primitive color palette like colorGreen* while applying opacities. As soon as we convert them to rgba values, it becomes hard to understand which primitive color is associated with.
Here is an example:

  • In design, we define styles like colorIndigo500 with 20% opacity
  • If we convert it to rgba it's rgba(35, 42, 68, 0.2) - It's almost impossible to remember that is Indigo500

Maintaining such rgba values for many styles in the code base is not good idea in general.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's almost impossible to remember that is Indigo500

I didn't get it

Maintaining such rgba values for many styles in the code base is not good idea in general.

But that’s exactly what you’ve done in this function - you’ve converted hex values to rgba.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In other words, rgba is a hard coded value which we should not have, in the same reason why we should not style using hex code. The function is a layer that that converts primitive values to raw values.

@georgylobko
georgylobko force-pushed the dev-v3-onetheme-accent-update branch from b3214e8 to ac49215 Compare July 27, 2026 08:02
@at-susie
at-susie added this pull request to the merge queue Jul 27, 2026
Merged via the queue into main with commit ee9b849 Jul 27, 2026
93 of 94 checks passed
@at-susie
at-susie deleted the dev-v3-onetheme-accent-update branch July 27, 2026 09:12
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