Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brown-bats-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

"Update logic for how hex codes are applied"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions packages/react/src/experimental/IssueLabel/IssueLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {clsx} from 'clsx'
import type React from 'react'
import {getColorsFromHex} from './getColorFromHex'
import classes from './IssueLabel.module.css'
import {readableColor} from 'color2k'

type Hex = `#${string}`

Expand Down Expand Up @@ -73,7 +73,13 @@ function IssueLabel<As extends React.ElementType>({
const sharedProps = {
className: clsx(className, classes.IssueLabel),
'data-variant': fillColor ? undefined : variant,
style: fillColor ? {...style, ...getColorsFromHex(fillColor)} : style,
style: fillColor
? {
...style,
backgroundColor: fillColor,
color: readableColor(fillColor),
}
: style,
Comment on lines +76 to +82
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.
}

if ('as' in props && props.as) {
Expand Down
158 changes: 0 additions & 158 deletions packages/react/src/experimental/IssueLabel/getColorFromHex.ts

This file was deleted.

Loading