Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: text on badge and button fills reaches 4.5:1 in the default themes

axe found the neutral badge, the primary button and a selected card's message
under AA in hyperhive light (4.39:1 and 3.82:1) and in the Mocha themes. A
light palette now lightens the --purple-dim fill, the Mocha palettes darken it,
and the muted text keeps more of the text colour.
This commit is contained in:
iris 2026-11-28 02:17:55 +01:00
commit 5b597b782f
3 changed files with 44 additions and 21 deletions

View file

@ -79,16 +79,19 @@ default palette). Default hexes shown are Catppuccin Mocha.
| `--pink` | `base0F` | `#f5c2e7` | thinking events | | `--pink` | `base0F` | `#f5c2e7` | thinking events |
| `--crust` | `mix(base00 58%, #000000)` | `#11111b` | scrims and shadows (below `--bg`) | | `--crust` | `mix(base00 58%, #000000)` | `#11111b` | scrims and shadows (below `--bg`) |
| `--code-bg` | `mix(base00 58%, #000000)` | `#11111b` | terminal / code block background | | `--code-bg` | `mix(base00 58%, #000000)` | `#11111b` | terminal / code block background |
| `--muted` | `mix(base05 58%, base00)` | `#8489a1` | secondary / dimmed text | | `--muted` | `mix(base05 64%, base00)` | `#8e94ad` | secondary / dimmed text |
| `--subtext0` | `mix(base05 77.7%, base00)` | `#a6adc8` | toolbar/status text; dimmer than `--fg`, lighter than `--muted` | | `--subtext0` | `mix(base05 77.7%, base00)` | `#a6adc8` | toolbar/status text; dimmer than `--fg`, lighter than `--muted` |
The shares in the `--muted`, `--subtext0` and `--code-bg` rows are the dark palette's. The shares in the `--muted`, `--subtext0` and `--code-bg` rows are the dark palette's, and what a palette that sets none of them keeps (`theme.css` holds them as fallbacks).
The light palette keeps more of the text colour (85% and 93%, set in `colors.css` as The Mocha palettes keep 66% for `--muted`, since the 64% leaves it under AA on the header's fill.
The light palette keeps more of the text colour (93% for both `--muted` and `--subtext0`, set in `colors.css` as
`--muted-share` and `--subtext0-share`), because the dark shares leave its dimmed `--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. For the same reason it text at 2.4:1 against a card, short of the 4.5:1 AA asks for. For the same reason it
keeps 95% of its background in `--code-bg` (`--code-bg-share`), as `--crust` is a mid keeps 95% of its background in `--code-bg` (`--code-bg-share`), as `--crust` is a mid
grey on a light palette and text on it fell to 2:1. A palette that sets none of these grey on a light palette and text on it fell to 2:1.
variables, such as a generated one, keeps the dark shares. The fill behind badges and primary buttons, `--purple-dim`, takes `--dim-share` of `base03` (the rest is `base00`): a light palette lightens it to 85%, so text on it reaches 4.5:1, and the Mocha palettes darken it to 75% for the same reason.
`--on-dim-share` (98% on a light palette, 90% otherwise) sets how much of `--fg` the dimmed label on that fill keeps.
A palette that sets none of these variables, such as a generated one, keeps the dark fallbacks: `--dim-share` 100% and `--on-dim-share` 90%.
The frosted surfaces (the headers, the badges, the terminal panes, the message box and the The frosted surfaces (the headers, the badges, the terminal panes, the message box and the
dashboard's banner) read two derived variables from `theme.css`. `--glass-clear` is `1` dashboard's banner) read two derived variables from `theme.css`. `--glass-clear` is `1`

View file

@ -135,7 +135,9 @@
--base0F: var(--hh-dark-base0F); --base0F: var(--hh-dark-base0F);
/* A dark pick over a light OS preference: the media query's shares must not /* A dark pick over a light OS preference: the media query's shares must not
carry over, so a dark palette sets its own, the defaults of theme.css. */ carry over, so a dark palette sets its own, the defaults of theme.css. */
--muted-share: 58%; --muted-share: 64%;
--dim-share: 100%;
--on-dim-share: 90%;
--subtext0-share: 77.7%; --subtext0-share: 77.7%;
--code-bg-share: 58%; --code-bg-share: 58%;
--palette-glass-clear: initial; --palette-glass-clear: initial;
@ -164,7 +166,9 @@
--base0E: var(--hh-light-base0E); --base0E: var(--hh-light-base0E);
--base0F: var(--hh-light-base0F); --base0F: var(--hh-light-base0F);
/* Dimmed text on a light palette: see `--muted-share` in theme.css. */ /* Dimmed text on a light palette: see `--muted-share` in theme.css. */
--muted-share: 85%; --muted-share: 93%;
--dim-share: 85%;
--on-dim-share: 98%;
--subtext0-share: 93%; --subtext0-share: 93%;
--code-bg-share: 95%; --code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */ /* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -192,7 +196,9 @@
--base0E: var(--hh-light-base0E); --base0E: var(--hh-light-base0E);
--base0F: var(--hh-light-base0F); --base0F: var(--hh-light-base0F);
/* Dimmed text on a light palette: see `--muted-share` in theme.css. */ /* Dimmed text on a light palette: see `--muted-share` in theme.css. */
--muted-share: 85%; --muted-share: 93%;
--dim-share: 85%;
--on-dim-share: 98%;
--subtext0-share: 93%; --subtext0-share: 93%;
--code-bg-share: 95%; --code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */ /* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -219,7 +225,9 @@
--base0E: var(--latte-base0E); --base0E: var(--latte-base0E);
--base0F: var(--latte-base0F); --base0F: var(--latte-base0F);
/* Dimmed text on a light palette: see `--muted-share` in theme.css. */ /* Dimmed text on a light palette: see `--muted-share` in theme.css. */
--muted-share: 85%; --muted-share: 93%;
--dim-share: 85%;
--on-dim-share: 98%;
--subtext0-share: 93%; --subtext0-share: 93%;
--code-bg-share: 95%; --code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */ /* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -247,7 +255,9 @@
--base0F: var(--mocha-base0F); --base0F: var(--mocha-base0F);
/* A dark pick over a light OS preference: the media query's shares must not /* A dark pick over a light OS preference: the media query's shares must not
carry over, so a dark palette sets its own, the defaults of theme.css. */ carry over, so a dark palette sets its own, the defaults of theme.css. */
--muted-share: 58%; --muted-share: 66%;
--dim-share: 75%;
--on-dim-share: 90%;
--subtext0-share: 77.7%; --subtext0-share: 77.7%;
--code-bg-share: 58%; --code-bg-share: 58%;
--palette-glass-clear: initial; --palette-glass-clear: initial;
@ -274,7 +284,9 @@
--base0F: var(--mara-base0F); --base0F: var(--mara-base0F);
/* A dark pick over a light OS preference: the media query's shares must not /* A dark pick over a light OS preference: the media query's shares must not
carry over, so a dark palette sets its own, the defaults of theme.css. */ carry over, so a dark palette sets its own, the defaults of theme.css. */
--muted-share: 58%; --muted-share: 66%;
--dim-share: 75%;
--on-dim-share: 90%;
--subtext0-share: 77.7%; --subtext0-share: 77.7%;
--code-bg-share: 58%; --code-bg-share: 58%;
--palette-glass-clear: initial; --palette-glass-clear: initial;

View file

@ -14,7 +14,13 @@
--bg: var(--base00); --bg: var(--base00);
--bg-elev: var(--base01); /* elevated surfaces: dropdowns, popovers */ --bg-elev: var(--base01); /* elevated surfaces: dropdowns, popovers */
--border: var(--base02); /* general borders, hover/active backgrounds */ --border: var(--base02); /* general borders, hover/active backgrounds */
--purple-dim: var(--base03); /* subtle borders, terminal chrome, badge bg */ /* Subtle borders, terminal chrome, badge bg. A light palette lightens it
(`--dim-share`) so the text on it reaches 4.5:1. */
--purple-dim: color-mix(
in srgb,
var(--base03) var(--dim-share, 100%),
var(--base00)
);
--fg: var(--base05); --fg: var(--base05);
--red: var(--base08); /* errors, fail state */ --red: var(--base08); /* errors, fail state */
--amber: var(--base09); /* warnings, pending / running state */ --amber: var(--base09); /* warnings, pending / running state */
@ -61,7 +67,7 @@
); );
--muted: color-mix( --muted: color-mix(
in srgb, in srgb,
var(--base05) var(--muted-share, 58%), var(--base05) var(--muted-share, 64%),
var(--base00) var(--base00)
); /* secondary / dimmed text */ ); /* secondary / dimmed text */
--subtext0: color-mix( --subtext0: color-mix(
@ -71,7 +77,7 @@
); /* toolbar/status text; dimmer than --fg, lighter than --muted */ ); /* toolbar/status text; dimmer than --fg, lighter than --muted */
/* `--muted-share` and `--subtext0-share` are how much of the text colour each /* `--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 mix keeps. A palette whose background is light sets them higher in
`colors.css`: at the dark palette's 58% the light one's muted text was `colors.css`: at the dark palette's 64% 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 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. */ that sets neither keeps the shares above. */
@ -93,11 +99,13 @@
and mara measured it at ~1.3:1 against her theme's badge fill — and mara measured it at ~1.3:1 against her theme's badge fill —
`--muted` had never been checked against anything but `--bg`. This `--muted` had never been checked against anything but `--bg`. This
variant mixes toward the *actual* surface it sits on instead, same variant mixes toward the *actual* surface it sits on instead, same
technique, correct anchor. Ceiling note: even plain `--fg` (100% — technique, correct anchor. `--on-dim-share` is how much `--fg` it keeps:
the max this can approach) only reaches ~3.4:1 against `--purple-dim` 90% leaves a visible label/value distinction on a dark palette; a light
in mara's theme, short of formal 4.5:1 AA for normal text — that's palette sets 98%, as 90% of its text colour on the lightened fill is
the theme's own limit, not something the anchor choice can fix. 90% under 4:1. */
gets close to that ceiling (~3:1, more than double the old ~1.3:1) --muted-on-dim: color-mix(
while keeping a hint of the label/value visual distinction. */ in srgb,
--muted-on-dim: color-mix(in srgb, var(--fg) 90%, var(--purple-dim)); var(--fg) var(--on-dim-share, 90%),
var(--purple-dim)
);
} }