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:
parent
5e81895a3b
commit
5b597b782f
3 changed files with 44 additions and 21 deletions
|
|
@ -79,16 +79,19 @@ default palette). Default hexes shown are Catppuccin Mocha.
|
|||
| `--pink` | `base0F` | `#f5c2e7` | thinking events |
|
||||
| `--crust` | `mix(base00 58%, #000000)` | `#11111b` | scrims and shadows (below `--bg`) |
|
||||
| `--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` |
|
||||
|
||||
The shares in the `--muted`, `--subtext0` and `--code-bg` rows are the dark palette's.
|
||||
The light palette keeps more of the text colour (85% and 93%, set in `colors.css` as
|
||||
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 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
|
||||
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
|
||||
grey on a light palette and text on it fell to 2:1. A palette that sets none of these
|
||||
variables, such as a generated one, keeps the dark shares.
|
||||
grey on a light palette and text on it fell to 2:1.
|
||||
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
|
||||
dashboard's banner) read two derived variables from `theme.css`. `--glass-clear` is `1`
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue