Skip to content

Add label border-color tokens#1237

Merged
langermank merged 7 commits into
mainfrom
label-borders
Jul 16, 2025
Merged

Add label border-color tokens#1237
langermank merged 7 commits into
mainfrom
label-borders

Conversation

@langermank

Copy link
Copy Markdown
Contributor

Add border-color tokens to support high contrast themes.

Copilot AI review requested due to automatic review settings July 9, 2025 23:13
@langermank langermank requested review from a team as code owners July 9, 2025 23:13
@langermank langermank requested a review from jonrohan July 9, 2025 23:13
@changeset-bot

changeset-bot Bot commented Jul 9, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f5488d5

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

This PR includes changesets to release 1 package
Name Type
@primer/primitives 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

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

This PR adds border-color token support to label components to enhance accessibility for high contrast themes. The changes systematically add borderColor properties to all label color variants, ensuring consistent border styling across different theme modes.

  • Adds borderColor tokens for all 21 label color variants (green, orange, purple, red, yellow, gray, auburn, brown, lemon, olive, lime, pine, teal, cyan, indigo, blue, plum, pink, coral, etc.)
  • Sets transparent borders for standard and dark themes while enabling foreground color borders for all high contrast theme variants
  • Maintains consistency with existing token structure and Figma integration patterns

Comment on lines +104 to +143
borderColor: {
$value: 'transparent',
$type: 'color',
$extensions: {
'org.primer.figma': {
collection: 'mode',
group: 'component',
scopes: ['borderColor'],
},
'org.primer.overrides': {
dark: {
$value: 'transparent',
},
'dark-dimmed': {
$value: 'transparent',
},
'light-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-dimmed-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-tritanopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-protanopia-deuteranopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'light-tritanopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'light-protanopia-deuteranopia-high-contrast': {
$value: '{label.green.fgColor}',
},
},
},
},

Copilot AI Jul 9, 2025

Copy link

Choose a reason for hiding this comment

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

The borderColor configuration is duplicated across all 21 label color variants with identical structure. Consider extracting this repetitive configuration into a shared template or mixin to reduce code duplication and improve maintainability.

Suggested change
borderColor: {
$value: 'transparent',
$type: 'color',
$extensions: {
'org.primer.figma': {
collection: 'mode',
group: 'component',
scopes: ['borderColor'],
},
'org.primer.overrides': {
dark: {
$value: 'transparent',
},
'dark-dimmed': {
$value: 'transparent',
},
'light-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-dimmed-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-tritanopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'dark-protanopia-deuteranopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'light-tritanopia-high-contrast': {
$value: '{label.green.fgColor}',
},
'light-protanopia-deuteranopia-high-contrast': {
$value: '{label.green.fgColor}',
},
},
},
},
borderColor: '{shared.borderColor}',

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Design Token Diff (CSS)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Design Token Diff (StyleLint)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Design Token Diff (Figma)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 9, 2025 23:22 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 9, 2025 23:25 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 9, 2025 23:26 Inactive
@langermank langermank added the update snapshots Update visual regression test snapshots label Jul 9, 2025
@github-actions github-actions Bot removed the update snapshots Update visual regression test snapshots label Jul 10, 2025
@primer primer Bot temporarily deployed to github-pages July 10, 2025 00:28 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 10, 2025 00:28 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 10, 2025 00:55 Inactive
@lukasoppermann

Copy link
Copy Markdown
Collaborator

It would be nice if we had a test like: https://primer.style/primitives/storybook/?path=/story/testing-colors--display-demo&globals=theme:light_high_contrast

Sadly I can not add copilot to your PR to do work which I guess is a good security thing.

Also why don't we use: --display-[color]-borderColor-emphasis instead of fgColor? And I am also wondering if we even need label colors if display colors doe exactly the same?

@lukasoppermann lukasoppermann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. It would be best if we had a demo like

@github-actions github-actions Bot temporarily deployed to Preview (Storybook) July 16, 2025 15:01 Inactive
@langermank langermank merged commit 889f65b into main Jul 16, 2025
27 checks passed
@langermank langermank deleted the label-borders branch July 16, 2025 16:25
@primer primer Bot mentioned this pull request Jul 16, 2025
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.

3 participants