Skip to content

Commit 6041c39

Browse files
fix(clerk-js,types): Parsed color adjustments (#6334)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 5fbf8df commit 6041c39

File tree

6 files changed

+30
-10
lines changed

6 files changed

+30
-10
lines changed

.changeset/nine-worms-count.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
- Render parsed `colorRing` at 15% vs 100%
7+
- Render parsed `colorModalBackdrop` at 73% vs 100%
8+
- Ensure `avatarBackground` and `avatarBorder` render with parsed neutral colors when `colorNeutral` is passed in via variables prop

packages/clerk-js/bundlewatch.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
{ "path": "./dist/clerk.browser.js", "maxSize": "72.2KB" },
55
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "115.08KB" },
66
{ "path": "./dist/clerk.headless*.js", "maxSize": "55KB" },
7-
{ "path": "./dist/ui-common*.js", "maxSize": "111.52KB" },
8-
{ "path": "./dist/ui-common*.legacy.*.js", "maxSize": "115.33KB" },
7+
{ "path": "./dist/ui-common*.js", "maxSize": "111.57KB" },
8+
{ "path": "./dist/ui-common*.legacy.*.js", "maxSize": "115.38KB" },
99
{ "path": "./dist/vendors*.js", "maxSize": "40.2KB" },
1010
{ "path": "./dist/coinbase*.js", "maxSize": "38KB" },
1111
{ "path": "./dist/stripe-vendors*.js", "maxSize": "1KB" },

packages/clerk-js/src/ui/customizables/parseVariables.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,17 @@ export const createColorScales = (theme: Theme) => {
7474
: colors.toHslaString(variables.colorInputBackground),
7575
colorShimmer: colors.toHslaString(variables.colorShimmer),
7676
colorMuted: variables.colorMuted ? colors.toHslaString(variables.colorMuted) : undefined,
77-
colorRing: variables.colorRing ? colors.toHslaString(variables.colorRing) : undefined,
77+
colorRing: variables.colorRing ? colors.makeTransparent(colors.toHslaString(variables.colorRing), 0.85) : undefined,
7878
colorShadow: variables.colorShadow ? colors.toHslaString(variables.colorShadow) : undefined,
79-
colorModalBackdrop: variables.colorModalBackdrop ? colors.toHslaString(variables.colorModalBackdrop) : undefined,
79+
colorModalBackdrop: variables.colorModalBackdrop
80+
? colors.makeTransparent(colors.toHslaString(variables.colorModalBackdrop), 0.27)
81+
: undefined,
82+
avatarBackground: neutralAlphaScale?.neutralAlpha400
83+
? colors.toHslaString(neutralAlphaScale.neutralAlpha400)
84+
: undefined,
85+
avatarBorder: neutralAlphaScale?.neutralAlpha200
86+
? colors.toHslaString(neutralAlphaScale.neutralAlpha200)
87+
: undefined,
8088
});
8189
};
8290

packages/clerk-js/src/ui/foundations/colors.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,17 @@ const colorMutedForeground = clerkCssVar(
8888
const colors = Object.freeze({
8989
avatarBorder: neutralAlphaScale.neutralAlpha200,
9090
avatarBackground: neutralAlphaScale.neutralAlpha400,
91-
colorModalBackdrop: clerkCssVar('color-modal-backdrop', neutralAlphaScale.neutralAlpha700),
91+
colorModalBackdrop:
92+
colorUtils.makeTransparent(clerkCssVar('color-modal-backdrop', defaultColorNeutral), 0.27) ||
93+
neutralAlphaScale.neutralAlpha700,
9294
colorBackground: clerkCssVar('color-background', 'white'),
9395
colorInput: clerkCssVar('color-input', 'white'),
9496
colorForeground,
9597
colorMutedForeground,
9698
colorMuted: undefined,
97-
colorRing: clerkCssVar('color-ring', neutralAlphaScale.neutralAlpha200),
99+
colorRing:
100+
colorUtils.makeTransparent(clerkCssVar('color-ring', defaultColorNeutral), 0.85) ||
101+
neutralAlphaScale.neutralAlpha200,
98102
colorInputForeground: clerkCssVar('color-input-foreground', '#131316'),
99103
colorPrimaryForeground: clerkCssVar('color-primary-foreground', 'white'),
100104
colorShimmer: clerkCssVar('color-shimmer', 'rgba(255, 255, 255, 0.36)'),

packages/clerk-js/src/ui/polishedAppearance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const BUTTON_OUTLINE_SHADOW = (color: string) =>
1010

1111
const cardContentStyles = (theme: InternalTheme) => ({
1212
borderWidth: 0,
13-
boxShadow: `${theme.shadows.$cardContentShadow}, ${BORDER_SHADOW_LENGTH} ${theme.colors.$neutralAlpha50}`,
13+
boxShadow: `${theme.shadows.$cardContentShadow}, ${BORDER_SHADOW_LENGTH} ${theme.colors.$borderAlpha50}`,
1414
});
1515

1616
const inputShadowStyles = (

packages/types/src/appearance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ export type Variables = {
738738
*/
739739
colorShimmer?: CssColor;
740740
/**
741-
* The color of the ring when an interactive element is focused.
741+
* The color of the ring when an interactive element is focused rendered at 15% opacity.
742742
* @default {@link Variables.colorNeutral} at 15% opacity
743743
*/
744744
colorRing?: CssColor;
@@ -753,8 +753,8 @@ export type Variables = {
753753
*/
754754
colorBorder?: CssColor;
755755
/**
756-
* The background color of the modal backdrop.
757-
* @default {@link Variables.colorNeutral} at 70% opacity
756+
* The background color of the modal backdrop rendered at 73% opacity.
757+
* @default {@link Variables.colorNeutral} at 73% opacity
758758
*/
759759
colorModalBackdrop?: CssColor;
760760
/**

0 commit comments

Comments
 (0)