Styling
Your plugin styles DropTerm with CSS conventions: a cascade of declarations, matched by selector and ordered by specificity, over the whole surface - app chrome included. Selectors are built from element names, classes, and ids, and specificity and source order decide what wins. Failure works by rule: one log line, the declaration drops, and nothing raises into the terminal.
Declarations
A declaration is one kebab-case property with one value. The vocabulary is closed, and it grows additively only - each addition takes its own ruling.
| Property | Values | Paints |
|---|---|---|
color | a theme token or #rrggbb | the text color |
background | a theme token or #rrggbb | the element fill |
font-weight | bold, normal | the glyph weight |
font-style | italic, normal | the slant |
text-decoration | underline, line-through, none | the decorations |
icon | a glyph string | the glyph prepended before the text |
The color tokens are the scheme's own words: accent (the scheme's BrightBlue), attention (the scheme's red: bright variant on a dark strip, plain on a light one), fg (the pane's foreground), bg (the worn scheme's background - the one addition chrome rules need), and the ANSI words
black,red,green,yellow,blue,magenta,cyan,white, and theirbright_black,bright_red,bright_green,bright_yellow,bright_blue,bright_magenta,bright_cyan,bright_whiteforms. A token resolves at paint through the scheme, and a theme or scheme flip re-resolves every rule live. An unknown property or value costs onedropterm:log line and drops that one declaration. The rest of the rule stands. There is noopacityand no script-set alpha anywhere: dimming is acolorrule, and nothing multiplies on top.
Selectors
A selector is one compound selector: an optional element name leads, then .class parts and one optional #id, in any order - tab.active, .warn, #main-meter, dialog-button.accent. Specificity is the CSS tuple (ids, then classes, then the element name), and inline declarations stand above all. There is no !important, no pseudo-classes, no descendant or child combinators, and no media queries - in v1, and by the ruling's shape, likely ever.
The cascade
All matching rules compete per property by specificity. Equal specificity breaks by source order, and source order is fixed:
- the host's builtin layer (the default look as ordinary rules)
- the manifest sheets, plugins in dir-name order
- the runtime sheets, in call arrival order
- the element's own inline
styletable, above everything
Unset properties inherit from the base layer, which holds the scheme's value for that surface. A node's resolved color flows into its spans' unset colors, the way CSS inheritance works (color and the font properties inherit; background and icon do not).
The addressable tree
Every addressable node carries a stable element name, and state and placement ride classes.
| Selector matches | Names and classes |
|---|---|
| The bands | chip per chip; chip.attention on a failed command or the missed-activity mark, chip.scrolled on the scrolled-back lines |
| The tab strip | tabstrip; tab per tab, tab.active for the focused one; tab.<class> reaches the tabs a plugin classes (the class of dropterm.tab_chips or of dropterm.tab_rows) and its background fills an inactive tab, the active one keeping its highlight. tab-badge is the decoration badge beside the title, wearing the row's own classes, so tab-badge.<class> colors the badge alone |
| Settings (the popup) | settings; settings-page per page root, classed per page - the words appearance, window, tabs, side-panel, dropdown, terminal, auto-complete, general (the page the strip formerly named advanced), profiles, keybindings, plugins (one rule per page, e.g. settings-page.appearance) |
| The modal surface | dialog; dialog-button per button; dialog-input for the input kind's text field (color only - the field paints its own background); dialog-item per pick row, #id its item id, dialog-item.selected for the highlighted one |
| The rails | panel; panel-view per docked view, on either rail and addressed by its id (panel-view#id, never by the rail); panel-input per view field (color only, for the typed text - the field paints its own background and hint); output-channel per output channel, #id its name; output-line per channel line |
| Typed content | span (chip spans, dialog body, panel rows), row (panel rows) |
The host's builtin layer carries the default look as ordinary rules: the primary button's look is the dialog-button.accent rule, the failed command's chip wears chip.attention, and the scrolled chip wears chip.scrolled. A plugin that out-specifies or out-orders a builtin replaces it by ordinary cascade. A panel row's numeric event id is not rule-addressable (a digit-led #id does not parse). Class rules address it.
The two sources
Manifest styles - plugin.json grows one key, "styles", a flat array of rule objects. Chrome restyles from launch with zero interpreter, and rebuilds on every hot reload:
{
"styles": [
{ "selector": "tab.active", "declarations": { "color": "accent", "font-weight": "bold" } },
{ "selector": "settings-page.plugins", "declarations": { "background": "#1a1b26" } }
]
}
A rule object outside the selector/declarations vocabulary costs one log line and is ignored. A rule with an empty selector, empty declarations, or unparseable selector syntax drops with one line naming it.
The runtime verb - one call replaces the caller's whole runtime sheet (the provider seats' replacement discipline):
dropterm.styles({
{ selector = 'chip.scrolled', declarations = { color = 'bright_black' } },
{ selector = '.warn', declarations = { color = 'red', icon = '⚠' } },
})
The sheet applies at call, repaints the surfaces it touches, and dies with its interpreter on teardown. When it dies, the manifest sheets, if any, stand alone. A plugin with both sources runs both, manifest rules ordered before runtime rules.
Every surface painted at once, in one window: the color-showcase example.
Trust, stated plainly
Your plugin can restyle app chrome - the bands, the tab strip, Settings, this page's whole tree - under the same full-trust model every plugin surface runs under (the plugins page states it once, at the top). Styles never run code and never take the keyboard. They paint.