Home /Modules/ui/THEMES.md

THEMES.md

lib/ui/THEMES.md · 69 line(s) · markdown

The four standard UI themes (lib/ui)

Four basic, excellent, powerful flavors — Blue, Gray, Black, White — over one unified token model. Pick a flavor (or let a source hint pick it) and the renderer draws the whole UI from its role tokens. Pure SLeeLa; every class checks and runs.

The flavors and their psychology

The four are a family: one accent family, one shared status set, one contrast discipline. Each exists for a reason, not a whim.

FlavorIntentWhybgsurfacetextaccent
Bluetrustdeep navy lowers arousal; steel-blue reads dependable, not loud#0B1A2F#12263F#EAF2FB#4F8CFF
Grayneutralgraphite recedes so content leads; low eye-fatigue#17191C#212429#E7E9EC#6EA8FE
Blackfocusmatte near-black floor + crisp white text; premium restraint#0A0A0C#121214#F4F6F8#5E9CFF
Whiteclaritysoft off-white (never #FFFFFF glare) + dark ink; daylight reading#F7F8FA#FFFFFF#16202C#1F6FEB

Shared across all four (so they are learnable): danger #D9534F, `success #3FA776,warning #E0A33E`. Every text/surface and accentText/accent pairing is tuned to clear WCAG 2.1 AA contrast — that is the quality bar.

The classes

ClassRole
SLStandardThemethe unified token model every flavor fills (bg/surface/surfaceHi/chrome/border/text/textDim/accent/accentText/focus + status)
SLThemeFlavorthe four presets — blue(), gray(), black(), white(), plus byId() / byName()
SLThemeHintsource-hint → renderer: resolves the flavor a document intends into a ready-to-render theme

Pick a flavor directly

SLThemeFlavor flavors = new SLThemeFlavor(); flavors.create();
SLStandardTheme t = flavors.blue();        < or .gray() / .black() / .white() >
String style = t.toStyle();                < what the renderer consumes >

Let the source hint the flavor (the renderer obeys)

A document states the flavor it intends with a single word — a #theme blue convention your app reads, a document-design keyword, or a user setting — and SLThemeHint resolves it:

SLThemeHint hint = new SLThemeHint(); hint.create();
hint.setFallback("Black");                 < used if the hint is unknown/empty >

SLStandardTheme theme = hint.resolve("white");   < from the source hint >
print(hint.report());                      < "theme hint 'white' -> White" >
< ... hand `theme` (its tokens) to the renderer; it produces the design ... >

An unknown hint falls back deliberately (never a guess) and says so: theme hint 'chartreuse' not recognized -> fell back to Black. The renderer never parses the hint itself — SLThemeHint does, and returns a complete theme.

Relationship to the organizing Frame and the native theme

Runnable: theme-demo.sleela.