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
2 changed files with 44 additions and 21 deletions

View file

@ -135,7 +135,9 @@
--base0F: var(--hh-dark-base0F);
/* 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. */
--muted-share: 58%;
--muted-share: 64%;
--dim-share: 100%;
--on-dim-share: 90%;
--subtext0-share: 77.7%;
--code-bg-share: 58%;
--palette-glass-clear: initial;
@ -164,7 +166,9 @@
--base0E: var(--hh-light-base0E);
--base0F: var(--hh-light-base0F);
/* 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%;
--code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -192,7 +196,9 @@
--base0E: var(--hh-light-base0E);
--base0F: var(--hh-light-base0F);
/* 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%;
--code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -219,7 +225,9 @@
--base0E: var(--latte-base0E);
--base0F: var(--latte-base0F);
/* 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%;
--code-bg-share: 95%;
/* No frosted glass on a light palette: see `--glass-clear` in theme.css. */
@ -247,7 +255,9 @@
--base0F: var(--mocha-base0F);
/* 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. */
--muted-share: 58%;
--muted-share: 66%;
--dim-share: 75%;
--on-dim-share: 90%;
--subtext0-share: 77.7%;
--code-bg-share: 58%;
--palette-glass-clear: initial;
@ -274,7 +284,9 @@
--base0F: var(--mara-base0F);
/* 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. */
--muted-share: 58%;
--muted-share: 66%;
--dim-share: 75%;
--on-dim-share: 90%;
--subtext0-share: 77.7%;
--code-bg-share: 58%;
--palette-glass-clear: initial;

View file

@ -14,7 +14,13 @@
--bg: var(--base00);
--bg-elev: var(--base01); /* elevated surfaces: dropdowns, popovers */
--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);
--red: var(--base08); /* errors, fail state */
--amber: var(--base09); /* warnings, pending / running state */
@ -61,7 +67,7 @@
);
--muted: color-mix(
in srgb,
var(--base05) var(--muted-share, 58%),
var(--base05) var(--muted-share, 64%),
var(--base00)
); /* secondary / dimmed text */
--subtext0: color-mix(
@ -71,7 +77,7 @@
); /* 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 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
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 —
`--muted` had never been checked against anything but `--bg`. This
variant mixes toward the *actual* surface it sits on instead, same
technique, correct anchor. Ceiling note: even plain `--fg` (100% —
the max this can approach) only reaches ~3.4:1 against `--purple-dim`
in mara's theme, short of formal 4.5:1 AA for normal text — that's
the theme's own limit, not something the anchor choice can fix. 90%
gets close to that ceiling (~3:1, more than double the old ~1.3:1)
while keeping a hint of the label/value visual distinction. */
--muted-on-dim: color-mix(in srgb, var(--fg) 90%, var(--purple-dim));
technique, correct anchor. `--on-dim-share` is how much `--fg` it keeps:
90% leaves a visible label/value distinction on a dark palette; a light
palette sets 98%, as 90% of its text colour on the lightened fill is
under 4:1. */
--muted-on-dim: color-mix(
in srgb,
var(--fg) var(--on-dim-share, 90%),
var(--purple-dim)
);
}