Skip to content

Commit 69d27f3

Browse files
prestonwebdevclaude
andcommitted
fix(mosaic): keep light-mode borders and raise status text contrast
Light-mode borders are 7 and 4 percent washes so they render as before on a white page; dark mode keeps 12 and 8 percent. The light negative, positive and warning seeds are darker so their text passes contrast on their own -subtle fills. The input placeholder gets its own value instead of following secondary text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent d948c90 commit 69d27f3

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎.changeset/mosaic-color-tokens.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
'@clerk/mosaic': minor
33
---
44

5-
Dark mode gives the profile its own shell color. `--cl-color-background` is replaced by `--cl-color-page`, the base layer (near-black in dark mode, white in light), which backs the profile shell. A new `--cl-color-surface` backs everything raised on it, such as cards, sections, menus, popovers and controls, and the gray ramp mixes into it. The surface is derived from the page (neutral mixed 5 percent into it in dark mode, white mixed 60 percent into it in light mode), so retinting `--cl-color-page` retints the shell, the surface and the ramp together, and light mode is unchanged with the default white page. `--cl-color-background-subtle` is renamed `--cl-color-surface-subtle`.
5+
Dark mode gives the profile its own shell color. `--cl-color-background` is replaced by `--cl-color-page`, the base layer (near-black in dark mode, white in light), which backs the profile shell. A new `--cl-color-surface` backs everything raised on it, such as cards, sections, menus, popovers and controls, and the gray ramp mixes into it. The surface is derived from the page (neutral mixed 5 percent into it in dark mode, white mixed 60 percent into it in light mode), so retinting `--cl-color-page` retints the shell, the surface and the ramp together, and with the default white page the shell, surface and borders look the same in light mode. `--cl-color-background-subtle` is renamed `--cl-color-surface-subtle`.
66

7-
Brand and the negative, positive and warning colors now share one set of derived tokens: `-foreground`, `-subtle`, `-border` and `-alpha-100|200|300`, so overriding a seed retints its companions. `-foreground` flips to dark text in dark mode where white would fail, and the dark negative is a little lighter. `--cl-color-brand-secondary` is removed. `--cl-color-neutral-subtle` is new. `--cl-color-border` and `--cl-color-border-subtle` are now neutral washes (12 and 8 percent), so they stay visible on the surface and faded fills, and `--cl-color-input-placeholder` follows `--cl-color-foreground-secondary`, which is slightly darker in light mode.
7+
Brand and the negative, positive and warning colors now share one set of derived tokens: `-foreground`, `-subtle`, `-border` and `-alpha-100|200|300`, so overriding a seed retints its companions. `-foreground` flips to dark text in dark mode where white would fail, and the dark negative is a little lighter. `--cl-color-brand-secondary` is removed. `--cl-color-neutral-subtle` is new. `--cl-color-border` and `--cl-color-border-subtle` are now neutral washes (7 and 4 percent in light mode, 12 and 8 in dark mode), so they stay visible on the surface and faded fills.
8+
9+
In light mode the negative, positive and warning colors are slightly darker so their text passes contrast on their own `-subtle` fill, `--cl-color-foreground-secondary` is a little darker, and `--cl-color-input-placeholder` has its own value that now passes contrast on the field.

‎packages/mosaic/ARCHITECTURE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const colorVars = stylex.defineVars({
2525

2626
Each exported `*Vars` const in that file is one group (`colorVars`, `radiusVars`, …); the file is the list. `space` is also declared with `defineVars`, but its keys are not `--cl-*` names, so its steps compile to hashed custom properties that are internal, not part of the contract.
2727

28-
There is no gray scale. Every achromatic token (`--cl-color-foreground`, `-border`, `-surface-subtle`, …) is `--cl-color-neutral` (black on light, white on dark) mixed into `--cl-color-surface` at a fixed percentage per mode, so overriding neutral to a warm gray retints the whole ramp. The exception is the borders: `--cl-color-border` (controls) is a 12 percent neutral wash and `--cl-color-border-subtle` (containers and dividers) an 8 percent one, in both modes, so they keep the same step over the surface and the faded surface alike. The `--cl-<color>-alpha-100|200|300` tokens in `colorVars` are washes (6, 8, and 12 percent of `--cl-color-neutral`, `-negative`, `-positive`, and `-warning` over `transparent`); overriding the solid color retints its washes.
28+
There is no gray scale. Every achromatic token (`--cl-color-foreground`, `-border`, `-surface-subtle`, …) is `--cl-color-neutral` (black on light, white on dark) mixed into `--cl-color-surface` at a fixed percentage per mode, so overriding neutral to a warm gray retints the whole ramp. The exception is the borders: `--cl-color-border` (controls) and `--cl-color-border-subtle` (containers and dividers) are neutral washes, 7 and 4 percent in light mode and 12 and 8 percent in dark mode, so they keep the same step over the surface and the faded surface alike. The `--cl-<color>-alpha-100|200|300` tokens in `colorVars` are washes (6, 8, and 12 percent of `--cl-color-neutral`, `-negative`, `-positive`, and `-warning` over `transparent`); overriding the solid color retints its washes.
2929

3030
The seeds are `--cl-color-page`, `--cl-color-neutral`, `--cl-color-brand`, `--cl-color-negative`, `--cl-color-positive` and `--cl-color-warning`. Brand and the three statuses share one shape: the seed, `-foreground` (white in light mode, the surface color in dark mode, where the fills are light), `-subtle` (the 8 percent wash, 12 in dark mode) and `-border` (the 12 percent wash), so both work over the page, the surface or a faded fill and `-alpha-100|200|300` washes. Neutral has the same slots under its own names: `--cl-color-surface-subtle`, `--cl-color-neutral-subtle` (the same wash as the accent `-subtle`, for chips such as the neutral badge) and `--cl-color-border`. Only the seeds and the `-foreground` pairs are set by hand, so retinting a seed retints its companions.
3131

‎packages/mosaic/src/tokens.stylex.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ const colorDefaults = {
4747
'--cl-color-foreground-secondary': neutralMix(55, 64.25),
4848
'--cl-color-foreground-disabled': neutralMix(28.5, 44),
4949

50-
'--cl-color-border': 'var(--cl-color-neutral-alpha-300)',
51-
'--cl-color-border-subtle': 'var(--cl-color-neutral-alpha-200)',
50+
'--cl-color-border':
51+
'light-dark(color-mix(in oklab, var(--cl-color-neutral) 7%, transparent), var(--cl-color-neutral-alpha-300))',
52+
'--cl-color-border-subtle':
53+
'light-dark(color-mix(in oklab, var(--cl-color-neutral) 4%, transparent), var(--cl-color-neutral-alpha-200))',
5254

5355
'--cl-color-brand': 'light-dark(oklch(0.2046 0 0), oklch(0.9851 0 0))',
5456
'--cl-color-brand-foreground': 'light-dark(oklch(1 0 0), var(--cl-color-surface))',
@@ -58,23 +60,23 @@ const colorDefaults = {
5860
'--cl-color-brand-alpha-200': 'color-mix(in oklab, var(--cl-color-brand) 8%, transparent)',
5961
'--cl-color-brand-alpha-300': 'color-mix(in oklab, var(--cl-color-brand) 12%, transparent)',
6062

61-
'--cl-color-negative': 'light-dark(oklch(0.577 0.2161 26.11), oklch(0.68 0.2 26.11))',
63+
'--cl-color-negative': 'light-dark(oklch(0.56 0.2161 26.11), oklch(0.68 0.2 26.11))',
6264
'--cl-color-negative-foreground': 'light-dark(oklch(1 0 0), var(--cl-color-surface))',
6365
'--cl-color-negative-subtle': 'light-dark(var(--cl-color-negative-alpha-200), var(--cl-color-negative-alpha-300))',
6466
'--cl-color-negative-border': 'var(--cl-color-negative-alpha-300)',
6567
'--cl-color-negative-alpha-100': 'color-mix(in oklab, var(--cl-color-negative) 6%, transparent)',
6668
'--cl-color-negative-alpha-200': 'color-mix(in oklab, var(--cl-color-negative) 8%, transparent)',
6769
'--cl-color-negative-alpha-300': 'color-mix(in oklab, var(--cl-color-negative) 12%, transparent)',
6870

69-
'--cl-color-positive': 'light-dark(oklch(0.6082 0.1799 145.47), oklch(0.7227 0.192 149.58))',
71+
'--cl-color-positive': 'light-dark(oklch(0.55 0.15 148), oklch(0.7227 0.192 149.58))',
7072
'--cl-color-positive-foreground': 'light-dark(oklch(1 0 0), var(--cl-color-surface))',
7173
'--cl-color-positive-subtle': 'light-dark(var(--cl-color-positive-alpha-200), var(--cl-color-positive-alpha-300))',
7274
'--cl-color-positive-border': 'var(--cl-color-positive-alpha-300)',
7375
'--cl-color-positive-alpha-100': 'color-mix(in oklab, var(--cl-color-positive) 6%, transparent)',
7476
'--cl-color-positive-alpha-200': 'color-mix(in oklab, var(--cl-color-positive) 8%, transparent)',
7577
'--cl-color-positive-alpha-300': 'color-mix(in oklab, var(--cl-color-positive) 12%, transparent)',
7678

77-
'--cl-color-warning': 'light-dark(oklch(0.7099 0.1888 44.94), oklch(0.7576 0.159 55.93))',
79+
'--cl-color-warning': 'light-dark(oklch(0.6 0.16 48), oklch(0.7576 0.159 55.93))',
7880
'--cl-color-warning-foreground': 'light-dark(oklch(1 0 0), var(--cl-color-surface))',
7981
'--cl-color-warning-subtle': 'light-dark(var(--cl-color-warning-alpha-200), var(--cl-color-warning-alpha-300))',
8082
'--cl-color-warning-border': 'var(--cl-color-warning-alpha-300)',
@@ -83,7 +85,7 @@ const colorDefaults = {
8385
'--cl-color-warning-alpha-300': 'color-mix(in oklab, var(--cl-color-warning) 12%, transparent)',
8486

8587
'--cl-color-input': 'var(--cl-color-surface)',
86-
'--cl-color-input-placeholder': 'var(--cl-color-foreground-secondary)',
88+
'--cl-color-input-placeholder': neutralMix(45, 64.25),
8789

8890
'--cl-color-ring': neutralMix(80, 90),
8991
} as const;

0 commit comments

Comments
 (0)