Skip to content

Commit c576e5b

Browse files
refactor(ui): Render colorRing and colorModalBackdrop at full opacity when modified (#7333)
1 parent 52d20e2 commit c576e5b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.changeset/bright-zebras-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': major
3+
---
4+
5+
Updates both `colorRing` and `colorModalBackdrop` to render at full opacity when modified via the appearance prop or CSS variables. Previously we'd render the provided color at 15% opacity, which made it difficult to dial in a specific ring or backdrop color.

packages/ui/src/customizables/parseVariables.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ export const createColorScales = (theme: Theme) => {
7373
: colors.toHslaString(variables.colorInputBackground),
7474
colorShimmer: colors.toHslaString(variables.colorShimmer),
7575
colorMuted: variables.colorMuted ? colors.toHslaString(variables.colorMuted) : undefined,
76-
colorRing: variables.colorRing ? colors.makeTransparent(colors.toHslaString(variables.colorRing), 0.85) : undefined,
76+
colorRing: variables.colorRing ? colors.toHslaString(variables.colorRing) : undefined,
7777
colorShadow: variables.colorShadow ? colors.toHslaString(variables.colorShadow) : undefined,
78-
colorModalBackdrop: variables.colorModalBackdrop
79-
? colors.makeTransparent(colors.toHslaString(variables.colorModalBackdrop), 0.27)
80-
: undefined,
78+
colorModalBackdrop: variables.colorModalBackdrop ? colors.toHslaString(variables.colorModalBackdrop) : undefined,
8179
avatarBackground: neutralAlphaScale?.neutralAlpha400
8280
? colors.toHslaString(neutralAlphaScale.neutralAlpha400)
8381
: undefined,

packages/ui/src/foundations/colors.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,19 @@ const colorMutedForeground = clerkCssVar(
8888
const colors = Object.freeze({
8989
avatarBorder: neutralAlphaScale.neutralAlpha200,
9090
avatarBackground: neutralAlphaScale.neutralAlpha400,
91-
colorModalBackdrop:
92-
colorUtils.makeTransparent(clerkCssVar('color-modal-backdrop', defaultColorNeutral), 0.27) ||
93-
neutralAlphaScale.neutralAlpha700,
91+
colorModalBackdrop: clerkCssVar(
92+
'color-modal-backdrop',
93+
colorUtils.makeTransparent(defaultColorNeutral, 0.27) || neutralAlphaScale.neutralAlpha700,
94+
),
9495
colorBackground: clerkCssVar('color-background', 'white'),
9596
colorInput: clerkCssVar('color-input', 'white'),
9697
colorForeground,
9798
colorMutedForeground,
9899
colorMuted: undefined,
99-
colorRing:
100-
colorUtils.makeTransparent(clerkCssVar('color-ring', defaultColorNeutral), 0.85) ||
101-
neutralAlphaScale.neutralAlpha200,
100+
colorRing: clerkCssVar(
101+
'color-ring',
102+
colorUtils.makeTransparent(defaultColorNeutral, 0.85) || neutralAlphaScale.neutralAlpha200,
103+
),
102104
colorInputForeground: clerkCssVar('color-input-foreground', '#131316'),
103105
colorPrimaryForeground: clerkCssVar('color-primary-foreground', 'white'),
104106
colorShimmer: clerkCssVar('color-shimmer', 'rgba(255, 255, 255, 0.36)'),

0 commit comments

Comments
 (0)