Skip to content

Conversation

@lukasoppermann
Copy link
Contributor

Closes #

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@lukasoppermann lukasoppermann requested a review from a team as a code owner November 25, 2025 13:42
@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: dce9d35

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

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

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 25, 2025
Copilot finished reviewing on behalf of lukasoppermann November 25, 2025 13:45
Copy link
Contributor

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 simplifies the hex color handling in the IssueLabel component by removing the complex getColorFromHex.ts utility and replacing it with a simpler inline implementation using color2k's readableColor function. However, this simplification removes critical functionality.

Key Changes:

  • Removed the entire getColorFromHex.ts file containing HSLuv color conversion and contrast ratio calculations
  • Simplified the fillColor handling to directly set backgroundColor and color properties
  • Replaced complex color generation logic with a simple readableColor() call

Reviewed changes

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

File Description
packages/react/src/experimental/IssueLabel/getColorFromHex.ts Deleted file containing 158 lines of color generation logic with HSLuv conversions, contrast ratio calculations, and light/dark mode support
packages/react/src/experimental/IssueLabel/IssueLabel.tsx Simplified fillColor handling to use readableColor() function instead of generating CSS custom properties for all states and themes

Comment on lines +76 to +82
style: fillColor
? {
...style,
backgroundColor: fillColor,
color: readableColor(fillColor),
}
: style,
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The simplified implementation loses critical functionality that was present in the previous code:

  1. No hover/active states for custom colors: The old implementation generated different colors for rest/hover/active states using CSS custom properties (--label-bgColor-rest, --label-bgColor-hover, --label-bgColor-active). The new implementation only sets static backgroundColor and color, so hover/active states won't work for custom fillColor values.

  2. No light/dark mode support for custom colors: The previous implementation generated separate color schemes for light and dark modes (e.g., --label-bgColor-light-rest, --label-bgColor-dark-rest). The new implementation only sets a single background color that won't adapt to theme changes.

  3. Loss of color refinement logic: The old implementation had sophisticated logic to avoid overly bright/intense colors by capping saturation based on hue ranges, ensuring better visual consistency across different input colors.

The CSS module still expects these custom properties (lines 9-37 in IssueLabel.module.css), so this change will break the styling for labels with custom fillColor values.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot requested a deployment to storybook-preview-7244 November 25, 2025 13:48 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7244 November 25, 2025 13:57 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7244 November 27, 2025 07:51 Inactive
@lukasoppermann lukasoppermann added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 27, 2025
@primer primer bot requested a review from a team as a code owner November 27, 2025 08:02
@primer primer bot requested a review from mperrotti November 27, 2025 08:02
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants