Styleguide¶
The Lustro console is a developer tool that looks like a terminal: dark theme
first, one blue accent, monospace text everywhere, dense, and high-contrast.
Everything below is in
shared.css, which the chrome
loads on every tab page. So Lustro's own tabs and your tabs get the same
design system, with no setup. This document is the contract for anyone
writing a tab.
1. Principles¶
- Mono everywhere. The console face is
--font-mono. No webfonts are loaded (CSP is'self'-only); the stack prefers locally installed terminal faces (Geist Mono,SF Mono, Menlo…) and degrades to the system monospace. - Uppercase, spaced labels. Section labels and controls:
font-size: 10.5-13px; font-weight: 600; letter-spacing: .08-.1em; text-transform: uppercase;. Use spaces, not underscores, in UI labels ("SEND REQUEST", not "SEND_REQUEST"). Real identifiers (table names, header keys) keep their underscores. - One accent.
--accent(blue) for primary actions, active states, focus, links.--ai(purple) is a secondary accent reserved for mock/AI/paused. Green (--live) = live/success, red (--danger) = danger. - Flat by default. Shadows appear only on floating layers (menus, modals, toasts). Everything else is separated by 1px borders and surface shifts.
- Never hardcode colors. Every surface, border, text shade, and semantic
color (HTTP method, status class, log level, value type, work state,
category) has a token. If you need a soft tinted fill, use
color-mix(in srgb, var(--c) 15%, transparent). - Comments as helper text. Secondary hints render like
// sent through the app's live OkHttp clientin--t4.
2. Tokens¶
Defined on :root (dark default) with light overrides under
[data-theme="light"]. Components never change between themes: only tokens do.
- Surfaces (darkest → raised):
--bg→--header/--panel→--field(inputs, wells, cards) →--raise(active/elevated, such as the pane behind an active tab).--tabbaris the recessed strip behind connected tabs;--menuis the dropdown/toast surface. - Lines:
--border(primary),--border-soft(faint),--grid(table column dividers),--row-border,--chip-border(inputs/chips),--btn-border,--tag-border,--hover-border. - Text ramp:
--t1headings ·--t2body/cells ·--t3muted labels ·--t4faint meta/placeholders/comments ·--t5disabled. Keep--t3/--t4for secondary text only, never primary content. - Accents:
--accent,--accent-2(lighter, for text),--accent-hover,--accent-soft(tinted bg),--accent-border.--ai,--liveand--dangerhave only the base,-softand-bordertokens: there is no--ai-2or--danger-hover. - Semantic sets (each themed for dark and light):
--method-get/post/put/ patch/delete/head,--status-2xx/3xx/4xx/5xx,--lvl-v/d/i/w/e/f(a log level; Fatal,--lvl-f, is a deeper red than Error),--type-string/boolean/int/long/float(a SharedPreferences or DataStore value's type; a string set and bytes have the string color, and a double the float color: their labels tell them apart),--work-enqueued/running/succeeded/failed/blocked/cancelled(a WorkManager work state; an event of a run takes the color of the state it leads to),--cat-sync/ai/config/media/auth/ other/wiretap,--host-1to--host-6(the tag of a host that is not one of the app's hosts, chosen by a hash of the host name; the tag's text tells two hosts with one color apart),--syn-key/str/num/bool/punc(JSON highlighting). - Row states:
--row-selected,--row-zebra,--row-hover,--row-warn,--row-error. - Radii:
--radius-sm3px ·--radius4px (default controls) ·--radius-md6px (menus, tab tops, segmented tracks) ·--radius-lg8px (modals) ·--radius-pill. - Misc:
--shadow-menu,--shadow-modal,--scrim,--scrim-strong,--search-highlight,--star.
3. Typography & spacing¶
| Use | Size | Weight | Tracking |
|---|---|---|---|
| Section label (UPPER) | 10.5-11px | 600 | .1em |
| Control / button text | 11-11.5px | 500 | .04em |
| Table cell / body | 12-12.5px | 400 | normal |
| Title (such as NETWORK TRAFFIC) | 13px | 600 | .06em |
| Nav item | 12px | 500/600 | .1em |
Rhythm: control padding ~8px 13px; table cells 9px 14px; toolbar gaps
8-12px; form field gaps 12-17px; pane edge padding 22px.
The chrome's content area (.dc-app__content) is full-bleed (no padding)
so split-pane tabs can fill the viewport. Tabs own their edge padding (use
22px, see the sample flags tab).
4. Components¶
Every tab gets the .dc-* component library, and the chrome is built from it
too. Semantic color is passed via the --c custom property where noted:
.dc-btn(+--primary,--soft,--active,--danger,--ghost-danger,--sm,--icon): transparent 1px-border buttons. Primary is solid accent,--ghost-dangeris red at rest (such as Clear),--dangerturns red on hover only, and--iconis a bare glyph button (✎ ✕). A disabled.dc-btngreys out, and a<select class="dc-btn">is a dropdown with a drawn ▾..dc-chip+.dc-chip__dot: pill filters with a colored leading dot;--active= accent-tinted..dc-seg/.dc-seg__item(--active): segmented control on a recessed track; the selected segment is solid accent..dc-seg--smis the compact one, for a mode switch inside a panel; its items keep a 30px hit target..dc-tabs/.dc-tab(--active)/.dc-tabpanel: connected panel tabs. The active tab lifts onto--raise, takes a top accent bar, and visually joins its panel..dc-toolbar: the title row above a list or grid. Put the title in a.dc-mono-label(an<h3>is fine) and push the actions right withmargin-left: auto..dc-field(+.dc-field__prefix,.dc-input),.dc-input--block,.dc-textarea,.dc-label,.dc-check(--on/--locked): inputs and labels..dc-switch+.dc-switch__track: an on/off setting that applies when it is flipped, such as a mock rule's Enabled. The markup is<label class="dc-switch"><input type="checkbox"><span class="dc-switch__track"></span></label>, and the input takes the events. On is the accent; set--cfor another color, as the sample flags tab does with--live. For a choice that a Save or an Apply button sends, use a.dc-checkinstead..dc-tablefamily (.dc-thead,.dc-th(--sortable/--sorted),.dc-row (--selected/--warn/--error),.dc-cell(--num/--null/--muted)): data grids, as a<table>or as div rows. Header cells stick to the top of the scroll area; rows are zebra-striped and highlight on hover..dc-badge(soft tinted fill) and.dc-tag(outlined), colored viastyle="--c: var(--method-get)";.dc-tag--mockis the dashed purple MOCK..dc-pill(+--live,--danger,.dc-pill__dot): the theme toggle (a<button>) and the LIVE / ERROR status pill in the top bar. The pill shows whether the console reaches the app: an error answer of the app leaves it LIVE, anddebugFetchanddebugPollset it, not the tab..dc-menufamily: dropdowns with single-select✓or multi-select checkboxes; close via a.dc-menu-scrimlayer..dc-modalfamily: keep the.dc-modal-scrimin your markup with thehiddenattribute and show or hide it withdebugModal(id); Escape and a click on the scrim close it.debugModal(id, { onHide })runsonHideeach time the dialog is hidden, also by Escape or the scrim. Actions go in.dc-modal__foot, primary first..dc-toast: shown bydebugToast(message, type), wheretypeissuccess,error,infoorwarning. Toasts stack bottom-right and go away after 3 s..dc-split/.dc-pane/.dc-divider: resizable panes, in the order pane, divider, pane. CalldebugInitResizers()once your markup is in the page; a drag stops at each pane's CSSmin-width..dc-json(.k/.s/.n/.b/.pspans, asdebugSyntaxHighlightJson()emits them) in a.dc-codewell:<pre class="dc-code dc-json">.- Body viewers. Each function takes a body's text, escapes all of it, and
returns one element's HTML;
{ searchText }marks the matches: a string, found as typed and ignoring case, or aRegExp.debugBodyKind(contentType, text, binary)says which one suits a body. .dc-tree:debugJsonTree(text)returns a<pre class="dc-code dc-json dc-tree">, ornullwhen the text is not JSON. Each object or array with members is a.dc-fold(its first line) followed by a.dc-fold__body.shared.jsfolds a node on click (.dc-fold--closed, which shows a count of what it hides), and Alt-click folds or unfolds everything inside it..dc-markup(.g/.t/.a/.s/.cspans: a tag, its name, an attribute name, an attribute value, a comment or declaration):debugHighlightMarkup(text, { html })indents XML, or HTML withhtml: true, and adds whitespace and nothing else. An element that holds text is shown as it arrived; only the elements that hold elements are indented..dc-lines(.dc-lines__linerows):debugLineNumbered(text)numbers the lines with CSS counters, which are never selected or copied. Each row keeps its line break, so a copied selection keeps empty lines..dc-kv(.dc-kv__key,.dc-kv__value, and.dc-kv__rawfor a part that is not valid percent-encoding): a key and value table.debugFormTable(text)builds one from anapplication/x-www-form-urlencodedbody.debugHexDump(bytes)returns text in thehexdump -Clayout. Put it in a.dc-codewell withtextContent..dc-listitem(+.dc-star),.dc-comment,.dc-mono-label, and the chrome shell:.dc-app,.dc-topbar,.dc-nav.- In a window narrower than the top bar, the tabs (
.dc-nav) scroll inside the bar, and.dc-topbar__actions, the theme toggle and the connection status, keep their width at the right end, so they are always visible. The page does not get wider than the window. The bar hides the scrollbar, because it would take height from the bar. Instead, an edge with more tabs past it fades out over 24 px:shared.jssets.dc-nav--more-startand.dc-nav--more-endfrom the scroll position. A swipe on a trackpad or a touch screen, a vertical mouse wheel over the tabs, and the Tab key scroll the tabs. A focused tab has its outline inside its box, because.dc-navclips what is outside a tab. When a page opens,shared.jsscrolls the tabs so that the active tab is in view and clear of the fade.
5. Showing and hiding¶
Hide an element with the hidden attribute (el.hidden = true), not with a
class or an inline display. shared.css has one global rule,
[hidden] { display: none !important; }, so hidden also hides a component
that sets display itself, such as a .dc-btn or a .dc-field, and a tab
needs no [hidden] rule of its own. The .dc-modal-scrim and .dc-menu layers
show and hide in the same way.
6. Theming¶
shared.js owns the theme: it cycles auto → light → dark, persists to
localStorage['debug-theme'], and sets data-theme on <html>. Tabs need to
do nothing: if every color in your CSS is a token (or a color-mix of
one), both themes work automatically. Semantic colors intentionally darken in
light mode for contrast; never collapse the two sets.
7. Tab-author rules¶
- Reference tokens, never hex values; pick the token by meaning.
- Build on the
.dc-*components before writing custom CSS; when you do write custom rules, follow the type table above. - Own your edge padding (
22px); the chrome content area is full-bleed. - CSP holds: external JS only, no inline
on*=handlers (usedata-actiondelegation), no inline<script>. Put styles in your tab's CSS file; the CSP also allows inline styles (style-src 'self' 'unsafe-inline'), so astyleattribute that sets a token, such asstyle="--c: ...", works. - Don't rely on color alone: pair semantic colors with a text label or letter.
- Hit targets ≥ 30px tall for buttons/inputs; ≥ 24px for icon affordances.
The sample tab (sample/src/debug/assets/lustro/flags.css) is the working
reference for a third-party tab on this system.