Skip to content

Add label border-color tokens #1237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 16, 2025
Merged

Add label border-color tokens #1237

merged 7 commits into from
Jul 16, 2025

Conversation

langermank
Copy link
Contributor

Add border-color tokens to support high contrast themes.

@Copilot 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
Copy link

changeset-bot bot commented Jul 9, 2025

🦋 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

Copy link
Contributor

@Copilot Copilot AI left a comment

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}',
},
},
},
},
Copy link
Preview

Copilot AI Jul 9, 2025

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.

Copy link
Contributor

github-actions bot commented Jul 9, 2025

Design Token Diff (CSS)

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

Copy link
Contributor

github-actions bot commented Jul 9, 2025

Design Token Diff (StyleLint)

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

Copy link
Contributor

github-actions bot commented Jul 9, 2025

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
Contributor

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?

Copy link
Contributor

@lukasoppermann lukasoppermann left a comment

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.

2 participants