Skip to main content

Module theme

Module theme 

Source
Expand description

The NeXTSTEP egui theme for the Improv GUI.

Lotus Improv ran on NeXTSTEP’s 2-bit grayscale display: four grays and no color at all. This module builds an [egui::Style] from exactly those four levels (plus the scroller trough), with square corners and 1 px strokes. Roles follow docs/reviews/2026-10-03-nextstep-visual-spec.md §1. Text is the bundled Arimo (§2), a Helvetica-metric face, installed by install_fonts. It is purely cosmetic: no behavior depends on it.

Constants§

ARROW
§4.8 arrow buttons: 18 px squares.
BLACK
Key-window title bars, grid rules, text, bevel dark edges.
BOLD
The font name and family of the bold face, for window and menu titles.
DARK_GRAY
Desktop, category tile faces, non-key title bars, disabled / weak text.
LIGHT_GRAY
Window and panel background, control faces, the selection fill.
TEXT_SIZE 🔒
NeXT’s one text size: Helvetica 12 everywhere (§2).
TROUGH
The scroller trough (the one value outside the four levels, spec §4.8).
WHITE
Grid cells, text fields, pressed faces, bevel light edges.

Functions§

apply
Apply the NeXTSTEP look to ctx at startup: pin the light theme slot first, so a system theme change can’t swap in egui’s stock visuals, then set next_style into that slot and install_fonts.
content
Undo the trough color inside scrolled content, so text edits stay WHITE.
hscroller_chrome
Draw and run a horizontal scroller in bar for out (an area whose own bar is hidden): grouped arrows scroll line points per click, the beveled knob drags, and a click in the trough beside the knob pages by a view.
hscroller_rects
The §4.4 horizontal scroller in bar (the bottom strip, right of the row tiles): its left and right arrow buttons grouped at the LEFT end, as in the reference, then the knob’s track.
install_fonts
Register the bundled Arimo with ctx: Regular first in the proportional family, ahead of egui’s default fonts (kept as glyph fallback), and Bold as the named family BOLD. [TextStyle::Heading] is pointed at the bold family here rather than in next_style, because a style naming an unregistered family panics when text is laid out; call this after set_style. Monospace is left as egui’s default.
knob_drag 🔒
Drag knob (it senses clicks too, so the egui bar under it never jumps): the scroll offset change for this frame’s drag, mapping the knob’s free travel (track_len minus the knob) onto the max scrollable points.
knob_span 🔒
Where a scroller knob spans along track for a view long window at offset into content: grown to min_len, kept inside the track.
next_scroll
Show area NeXT-style: the bar always there, its trough TROUGH, with scroller_chrome on top (one line = one interact row). egui paints the trough with extreme_bg_color, which is WHITE for text edits, so it is swapped for the scroller only and restored for add.
next_style
Build the NeXTSTEP [Style]. Applied once at startup by apply.
raised 🔒
A raised NeXT face: LIGHT_GRAY with a white top-left, black bottom-right 1 px bevel.
scroll_to 🔒
Store offset (clamped to 0..=max) on axis of out’s area if it moved, and repaint so the area shows it.
scroller_chrome
Repaint a shown vertical scroller NeXT-style: a knob with a 1 px bevel (white top-left, black bottom-right) above two grouped arrow buttons, each click scrolling line points. outer is the area plus its bar as laid out (out.inner_rect is the pre-shrink rect, so it can’t be used). The knob drags 1:1 with the pointer (ours, not egui’s whole-trough mapping), so it also works when the bar is drawn at a viewport edge egui’s own bar is scrolled away from (a grid wider than its window).
scroller_rects
The vertical trough at the right of a non-floating scroll area’s outer rect (area plus bar), then its up and down arrow buttons grouped at the trough’s bottom end.