Skip to content

Lip Gloss

Lip Gloss is the styling/layout companion to Bubble Tea: a library for declaring the appearance of terminal text the way CSS declares the appearance of HTML. Each Style object accumulates a small set of properties — foreground, background, bold/italic/underline, padding, margin, border, width, height, alignment — and renders to ANSI-styled strings. The library also includes a small compositor (JoinHorizontal, JoinVertical, Place) for laying panes side by side and on top of each other, adaptive and downsampled color (so the same code looks right on a 24-bit terminal, an 8-bit one, and a no-color CI log), and three higher-level components: a Table builder, a List builder, and a Tree builder.

  • CSS-like declarative styling is the right grain for KN-86 cart authoring. Cart authors should describe what a pane looks like rather than emit escape sequences. A Lip-Gloss-style API exposed through NoshAPI (docs/adr/ADR-0005) gives cart Lisp a (style :fg 'amber :border 'single :padding 1) primitive instead of forcing carts to ladder up from text-puts.
  • Adaptive / downsampled color is the right runtime discipline. KN-86 is monochrome amber on the primary display but the desktop emulator runs on full-color terminals; the same render pipeline should work both ways without conditionals. Lip Gloss handles this by detecting terminal capabilities and gracefully downsampling — same Style, different render on a 256-color vs a true-color vs a no-color terminal.
  • JoinHorizontal / JoinVertical / Place for layout. Three primitives are enough for almost every TUI layout problem, including KN-86’s master/detail and dense multi-pane Bare Deck Terminal surfaces.
  • Table, List, Tree as pre-built components. Matches the data-density discipline called out in the Batch-2 visual-identity brief — every KN-86 surface that’s a table-of-things should reach for the same primitive, not reinvent box drawing per cart.
  • Border presets. Lip Gloss ships single-line, double-line, thick, rounded, hidden, ASCII, and Markdown-style borders out of the box. KN-86 should commit to single-line + double-line as the two sanctioned border styles (matching the existing CP437 box-drawing inventory) and ignore the rest — but having presets to choose from is a useful UI palette for cart authors.

Lip Gloss writes ANSI escape sequences to stdout. On the KN-86 Pi Zero 2 W those go to the framebuffer-attached Linux VT and are interpreted normally. Same code path as the desktop emulator; the only difference is TERM and the terminal’s reported color depth.

Lip Gloss styled panel example

Source: Lip Gloss README example — shows the kind of bordered, padded panels with foreground/background color that make up most of the library’s idiom.

  • Used in concert with Bubble Tea, not standalone. The Bubble Tea View() method calls into Lip Gloss styles to produce the rendered string. Adopting one without the other is technically possible but loses the integration benefit.
  • The lipgloss/list and lipgloss/tree packages are recent. Worth reading for KN-86 list-and-tree surfaces (mission board, cart manifest, REPL history).
  • For NoshAPI surface design: the right move is probably to expose a Lip-Gloss-shaped Style abstraction through the Fe-VM cart Lisp (as a struct-like value with a small builder API), not to dynamic-link Lip Gloss itself. The library is the reference; the API is hand-shaped to the cart-authoring grammar.