diff --git a/docs/web-ui/css-vars.md b/docs/web-ui/css-vars.md index 90ba5f9c..daf8b2b0 100644 --- a/docs/web-ui/css-vars.md +++ b/docs/web-ui/css-vars.md @@ -71,6 +71,12 @@ default palette). Default hexes shown are Catppuccin Mocha. | `--muted` | `mix(base05 55.5%, base00)` | `#7f849c` | secondary / dimmed text | | `--subtext0` | `mix(base05 77.7%, base00)` | `#a6adc8` | toolbar/status text; dimmer than `--fg`, lighter than `--muted` | +The shares in the `--muted` and `--subtext0` rows are the dark palette's. The light +palette keeps more of the text colour (85% and 93%, set in `colors.css` as +`--muted-share` and `--subtext0-share`), because the dark shares leave its dimmed +text at 2.4:1 against a card, short of the 4.5:1 AA asks for. A palette that sets +neither variable, such as a generated one, keeps the dark shares. + ## Common mistakes The Catppuccin colour names **don't** map 1:1 to the variable names. diff --git a/frontend/packages/shared/src/colors.css b/frontend/packages/shared/src/colors.css index 927a842b..f9fdd650 100644 --- a/frontend/packages/shared/src/colors.css +++ b/frontend/packages/shared/src/colors.css @@ -128,6 +128,9 @@ --base0D: var(--latte-base0D); --base0E: var(--latte-base0E); --base0F: var(--latte-base0F); + /* Dimmed text on the light palette: see `--muted-share` in theme.css. */ + --muted-share: 85%; + --subtext0-share: 93%; } } @@ -159,6 +162,9 @@ --base0D: var(--latte-base0D); --base0E: var(--latte-base0E); --base0F: var(--latte-base0F); + /* Dimmed text on the light palette: see `--muted-share` in theme.css. */ + --muted-share: 85%; + --subtext0-share: 93%; } :root[data-theme="dark"] { --base00: var(--mocha-base00); diff --git a/frontend/packages/shared/src/theme.css b/frontend/packages/shared/src/theme.css index f26561f5..a1d3d389 100644 --- a/frontend/packages/shared/src/theme.css +++ b/frontend/packages/shared/src/theme.css @@ -36,14 +36,19 @@ ); /* terminal / code bg, below --bg */ --muted: color-mix( in srgb, - var(--base05) 55.5%, + var(--base05) var(--muted-share, 55.5%), var(--base00) ); /* secondary / dimmed text */ --subtext0: color-mix( in srgb, - var(--base05) 77.7%, + var(--base05) var(--subtext0-share, 77.7%), var(--base00) ); /* toolbar/status text; dimmer than --fg, lighter than --muted */ + /* `--muted-share` and `--subtext0-share` are how much of the text colour each + mix keeps. A palette whose background is light sets them higher in + `colors.css`: at the dark palette's 55.5% the light one's muted text was + 2.4:1 against its card background, short of the 4.5:1 AA asks for. A palette + that sets neither keeps the shares above. */ /* `--muted`, above, is mixed toward `--base00`/`--bg` — correct for dimmed text on the page background, wrong for dimmed text sitting on