.talos-terminal renders a shell session line by line in mono. It sits next to
two neighbours in talos-data.css: .talos-code is a source listing (syntax
colours, a copy bar, no prompts) and .talos-log is a timestamped event feed.
The terminal has neither levels nor timestamps nor syntax highlighting: it has
commands, their output and a cursor. It lives in the talos-terminal.css
module, which all.css loads.
Transcript
<div class="talos-terminal" role="region" aria-label="Deploy session" tabindex="0">
<div class="talos-terminal__line talos-terminal__line--cmd">bun run build</div>
<div class="talos-terminal__line talos-terminal__line--dim">$ astro build</div>
<div class="talos-terminal__line talos-terminal__line--out">dist/wc/index.js 42 kB</div>
<div class="talos-terminal__line talos-terminal__line--ok">build complete in 3.2s</div>
<div class="talos-terminal__line talos-terminal__line--cmd">git push origin main</div>
<div class="talos-terminal__line talos-terminal__line--warn">warning: 2 files over 50 kB</div>
<div class="talos-terminal__line talos-terminal__line--err">error: remote rejected (protected branch)</div>
<div class="talos-terminal__line talos-terminal__line--cmd"><span class="talos-terminal__cursor"></span></div>
</div>
A scrollable region needs a name and keyboard access, hence role="region",
aria-label and tabindex="0". Every command line after the first gets a
little space above it, so each command and its output read as one block.
The prompt is not copied
The $ glyph of a --cmd line is generated content (::before, with
user-select: none). Select the first line in the demo above and paste it:
you get bun run build, never $ bun run build. The glyph comes from the
--talos-terminal-glyph token, so a different shell is one declaration.
<div class="talos-terminal" style="--talos-terminal-glyph: 'PS> '">…</div>
Line types
<div class="talos-terminal__line talos-terminal__line--cmd">…</div>
<div class="talos-terminal__line talos-terminal__line--out">…</div>
<div class="talos-terminal__line talos-terminal__line--ok">…</div>
<div class="talos-terminal__line talos-terminal__line--warn">…</div>
<div class="talos-terminal__line talos-terminal__line--err">…</div>
<div class="talos-terminal__line talos-terminal__line--dim">…</div>
<div class="talos-terminal__line talos-terminal__line--hl">…</div>
--hl raises the line’s background and draws a leading bar; it spans the full
scroll width even when other lines are longer than the box.
Cursor
<div class="talos-terminal__line talos-terminal__line--cmd">
tail -f /var/log/talos.log<span class="talos-terminal__cursor"></span>
</div>
.talos-terminal__cursor is a block caret that blinks on a 1.1s step. Under
prefers-reduced-motion: reduce it holds on, solid.
Long lines: scroll or wrap
<div class="talos-terminal">…</div> <!-- scrolls, fades at the edge -->
<div class="talos-terminal talos-terminal--wrap">…</div> <!-- wraps, hanging indent -->
By default lines do not wrap: a long line scrolls horizontally and the
overflowing edge fades (the scroll-driven talos-code-fade from
talos-data.css). --wrap wraps instead, and a wrapped command hangs under
its prompt glyph.
Tokens
Every colour is a --talos-terminal-* token mapped onto a surface, text or
band token in tokens.css. Rebind any of them on an ancestor to re-skin the
terminal.
<div class="talos-terminal" style="
--talos-terminal-bg: hsl(150 30% 6%);
--talos-terminal-fg: hsl(140 70% 70%);
--talos-terminal-out: hsl(140 30% 60%);
--talos-terminal-prompt: hsl(140 70% 45%);">…</div>
| Token | Default | Paints |
|---|---|---|
--talos-terminal-bg | --talos-surface-1 | the surface |
--talos-terminal-fg | --talos-text-primary | commands, the cursor, --hl text and bar |
--talos-terminal-out | --talos-text-secondary | --out |
--talos-terminal-dim | --talos-text-tertiary | --dim |
--talos-terminal-prompt | --talos-text-tertiary | the prompt glyph |
--talos-terminal-ok | --talos-success | --ok |
--talos-terminal-warn | --talos-warning | --warn |
--talos-terminal-err | --talos-danger | --err |
--talos-terminal-hl | foreground at 7% | --hl background |
--talos-terminal-glyph | "$ " | the prompt text |
Put a terminal inside a window for the title bar; the window hands it the bottom-left cut.