Dialogs, toasts, popovers, dropdowns and the filter popover appeared with no transition, and the header menu had a keyframe of its own. theme.css holds --enter and --fade, off under reduced motion and the motion setting's reduce, and each floating box uses them.
154 lines
6.1 KiB
CSS
154 lines
6.1 KiB
CSS
/* Semantic theme layer — derived from the base16 contract in
|
|
`colors.css`. This is what the app references (`--bg`, `--fg`,
|
|
`--purple`, …); page CSS must use these names, never literal colours
|
|
and never the raw `--baseNN` slots.
|
|
|
|
Standalone stylesheet, linked by every page right AFTER `colors.css`
|
|
(which defines the `--baseNN` slots these rules resolve against). Kept
|
|
separate from the page bundles — esbuild would otherwise inline an
|
|
`@import` and bake the palette into every CSS bundle.
|
|
|
|
A theme swap touches only `colors.css` (the 16 base16 slots); this
|
|
derivation layer never changes. See docs/4-implementation/web-ui/css-vars.md. */
|
|
:root {
|
|
--bg: var(--base00);
|
|
--bg-elev: var(--base01); /* elevated surfaces: dropdowns, popovers */
|
|
--border: var(--base02); /* general borders, hover/active backgrounds */
|
|
/* 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 */
|
|
--yellow: var(--base0A); /* flash messages, mild warnings */
|
|
--green: var(--base0B); /* success, ok state */
|
|
--cyan: var(--base0C); /* tool-use events, info accents */
|
|
--blue: var(--base0D); /* links, interactive accent (distinct from cyan) */
|
|
--purple: var(--base0E); /* accent — active tabs, links, highlights */
|
|
--pink: var(--base0F); /* thinking events */
|
|
|
|
/* Layering: one scale for every page. Local stacking inside a component
|
|
(1, 2) stays a plain number. */
|
|
--z-bar: 10; /* sticky bars: the header, selection bars */
|
|
--z-popover: 20; /* every floating box: menus, dropdowns, popovers, filters */
|
|
--z-skip: 100; /* the skip link, above everything but dialogs */
|
|
--z-modal: 1000; /* dialogs */
|
|
--z-toast: 1100; /* toasts, above dialogs */
|
|
|
|
/* Corners: small (chips, inputs), medium (boxes, cards), pill. */
|
|
--radius-sm: 0.35em;
|
|
--radius-md: 0.5em;
|
|
--radius-pill: 999px;
|
|
|
|
/* The shadow of every floating box. */
|
|
--shadow-pop: 0 0.3em 1em rgba(0, 0, 0, 0.4);
|
|
|
|
/* Off-base16 (no exact slot) — derived from base16 so they still track
|
|
a swap. Each is pixel-identical to its prior literal under the
|
|
default palette: --crust is a darkened bg; --muted / --subtext0 are
|
|
foreground↔background blends (two levels of dimmed text). */
|
|
--crust: color-mix(
|
|
in srgb,
|
|
var(--base00) 58%,
|
|
#000000
|
|
); /* scrims and shadows: a darkened bg, in both themes */
|
|
/* The surface text sits on in a terminal or a code block. In the dark theme
|
|
it is `--crust`, below `--bg`. A light palette keeps nearly all of its
|
|
background (`--code-bg-share` in `colors.css`), as `--crust` is a mid
|
|
grey there and the text on it fell to 2:1. */
|
|
--code-bg: color-mix(
|
|
in srgb,
|
|
var(--base00) var(--code-bg-share, 58%),
|
|
#000000
|
|
);
|
|
--muted: color-mix(
|
|
in srgb,
|
|
var(--base05) var(--muted-share, 64%),
|
|
var(--base00)
|
|
); /* secondary / dimmed text */
|
|
--subtext0: color-mix(
|
|
in srgb,
|
|
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 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. */
|
|
|
|
/* The frosted-glass surfaces (headers, badges, terminal panes, the message
|
|
box) are see-through over a blur on the dark palette and solid on the light
|
|
one, where bright content behind them would wash the text out.
|
|
`--glass-clear` is 1 for glass and 0 for solid; a surface keeps
|
|
`calc(100% - its-clear-share * var(--glass-clear))` of its fill colour, and
|
|
`--glass-filter` is its `backdrop-filter`. A light palette sets
|
|
`--palette-glass-clear` and `--palette-glass-filter` in `colors.css`, and
|
|
the solid-backgrounds setting sets the two final tokens itself. */
|
|
--glass-clear: var(--palette-glass-clear, 1);
|
|
--glass-filter: var(--palette-glass-filter, blur(8px) saturate(130%));
|
|
|
|
/* `--muted`, above, is mixed toward `--base00`/`--bg` — correct for
|
|
dimmed text on the page background, wrong for dimmed text sitting on
|
|
an elevated fill like `--purple-dim` (badge/dropdown-item
|
|
backgrounds). Case in point: `.ui-badge-label` used bare `--muted`
|
|
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. `--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)
|
|
);
|
|
}
|
|
|
|
/* Entrance motion. A floating box (a menu, a popover, a toast, a dialog) fades
|
|
in and drops a few pixels into place as it opens, and a dialog's backdrop
|
|
fades in. `--enter` and `--fade` are whole `animation` values, so a rule
|
|
writes `animation: var(--enter)` and the motion guard lives here once: off
|
|
under `prefers-reduced-motion` and the motion setting's "reduce", back on
|
|
for "allow". */
|
|
:root {
|
|
--enter: ui-enter 0.14s ease-out;
|
|
--fade: ui-fade 0.14s ease-out;
|
|
}
|
|
@media (prefers-reduced-motion: reduce) {
|
|
:root {
|
|
--enter: none;
|
|
--fade: none;
|
|
}
|
|
}
|
|
:root[data-motion="reduce"] {
|
|
--enter: none;
|
|
--fade: none;
|
|
}
|
|
:root[data-motion="allow"] {
|
|
--enter: ui-enter 0.14s ease-out;
|
|
--fade: ui-fade 0.14s ease-out;
|
|
}
|
|
@keyframes ui-enter {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-4px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: none;
|
|
}
|
|
}
|
|
@keyframes ui-fade {
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
}
|