struct Theme
Swift
struct Theme
Semantic styling tokens.
The point of naming tokens by role rather than by appearance is that a
view says .accent, not Color(r: 0.7, ...), so a theme swap does not
require touching a single view. Color.primary and friends already read
this way at call sites; they now resolve through here instead of being
frozen constants.
Sources/LavaUI/Theme.swift:26
Constructors
init(textPrimary: Color, textSecondary: Color, textMuted: Color, textDim: Color, accent: Color, selected: Color, background: Color, panel: Color, inset: Color, canvas: Color, hover: Color, selectionFill: Color, border: Color, borderWidth: Float = 1, cornerRadius: Float = 4, controlPadding: Float = 4, stackSpacing: Float = 8, caretWidth: Float = 1.5, focusRingStyle: FocusRingStyle = .rounded, focusRingWidth: Float = 1.5, focusRingColor: Color? = nil)
Creates a theme. Every parameter matches the property of the same name.
Sources/LavaUI/Theme.swift:76
Properties
var accent: Color
Emphasis for headings and focus rings.
Sources/LavaUI/Theme.swift:37
var background: Color
Window background, behind everything.
Sources/LavaUI/Theme.swift:43
var border: Color
Colour of outlines and dividers.
Sources/LavaUI/Theme.swift:57
var borderWidth: Float
Width of outlines and dividers, in points.
Sources/LavaUI/Theme.swift:59
static var builtIns: [BuiltIn] { get }
Palettes the system theme understands, in the order Settings lists them.
Sources/LavaUI/Theme.swift:277
var canvas: Color
The diagram canvas.
Sources/LavaUI/Theme.swift:49
var caretWidth: Float
Width of the text caret, in points.
Sources/LavaUI/Theme.swift:67
var controlPadding: Float
Inner padding for controls such as text fields.
Sources/LavaUI/Theme.swift:63
var cornerRadius: Float
Default corner radius for panels and controls. 0 gives hard corners.
Sources/LavaUI/Theme.swift:61
nonisolated(unsafe) static var current: Theme { get set }
App-wide default theme. Environment.current.theme falls through to
this wherever no .theme(_:) override is in scope, so setting it still
reaches everything that never opted out — but a subtree wearing
.theme(_:) no longer has to go through here at all.
Sources/LavaUI/Theme.swift:293
static let dark: Theme
The palette this app shipped with, kept as-is so the theme migration changes nothing visually until someone chooses a different one.
Sources/LavaUI/Theme.swift:113
static let ember: Theme
Warm charcoal with copper light, the night-side counterpart to paper.
Dark's greys are cool on purpose — they sit behind code and disappear. Ember is the same darkness with the colour temperature flipped, so a desktop that wants firelight rather than a monitor in a basement has somewhere to go that is still a dark theme.
Sources/LavaUI/Theme.swift:188
var focusRingColor: Color?
Focus ring colour. nil uses accent.
Sources/LavaUI/Theme.swift:73
var focusRingStyle: FocusRingStyle
Shape of the focused-field chrome. Defaults to a full rounded outline.
Sources/LavaUI/Theme.swift:69
var focusRingWidth: Float
Stroke thickness for the focus ring (also used by .underline).
Sources/LavaUI/Theme.swift:71
static let graphite: Theme
Near-black with a hard white, for a desktop that wants contrast rather than atmosphere. The accent keeps a drop of blue so links and focus rings do not disappear into the grey.
Sources/LavaUI/Theme.swift:244
var hover: Color
Row highlight under the pointer.
Sources/LavaUI/Theme.swift:51
var inset: Color
Inset surfaces: text fields, wells.
Sources/LavaUI/Theme.swift:47
static let light: Theme
A light palette: dark text on pale surfaces.
One cool slate hue for every grey and every quiet text, so nothing
reads as a second palette. The muted and dim text used to be the dark
theme's green-grey, olive on these surfaces; the background was tinted
cyan beside a neutral panel; and the hover was a saturated sky blue,
a loud block under the pointer where dark's is a quiet step up.
Sources/LavaUI/Theme.swift:136
static let moss: Theme
Deep forest. Green enough to be a choice, quiet enough to put a wall of icons on — the same job nebula does in indigo.
Sources/LavaUI/Theme.swift:206
static let nebula: Theme
Deep indigo with a cyan/magenta pair, for surfaces that sit over a desktop rather than filling a window.
The greys exist to disappear behind content, which is right for an editor and wrong for a launcher: there the surface is most of what is on screen, and neutral grey over a photograph reads as a smudge rather than as a thing. This is still dark and still low-chroma enough to put a wall of app icons on, but it has a hue, so what is behind it is clearly behind something.
selected and accent are far apart on the wheel on purpose — the two
mean different things (where you are, versus what is important) and a
palette that makes them cousins loses that distinction exactly when a
keyboard-driven grid needs it most.
Sources/LavaUI/Theme.swift:166
nonisolated(unsafe) static var onSystemUpdate: ((Theme) -> Void)?
Called after a compositor system-theme push is applied to current.
Apps that paint their own paper (a terminal, a player) can retint
here. Nil is the usual case — Theme.current already rebuilt the
tree.
Sources/LavaUI/Theme.swift:308
var panel: Color
Side panels and other raised chrome.
Sources/LavaUI/Theme.swift:45
static let paper: Theme
Warm paper. light is a cool daylight grey; this is the same
brightness with the yellow left in, so a page reads as a page
rather than as a window.
Sources/LavaUI/Theme.swift:225
var selected: Color
Current selection in a list — deliberately distinct from accent.
Sources/LavaUI/Theme.swift:39
var selectionFill: Color
Text selection highlight.
Sources/LavaUI/Theme.swift:53
var stackSpacing: Float
Default distance between adjacent views in a stack when its spacing is nil.
Sources/LavaUI/Theme.swift:65
var textDim: Color
The faintest text: disabled menu items, shortcut hints, quotes.
Sources/LavaUI/Theme.swift:35
var textMuted: Color
Placeholders and hints.
Sources/LavaUI/Theme.swift:33
var textPrimary: Color
Body text.
Sources/LavaUI/Theme.swift:29
var textSecondary: Color
Labels, captions and other text one step down from the body.
Sources/LavaUI/Theme.swift:31
Methods
static func named(_ name: String) -> Theme?
The names the compositor's system theme understands.
Sources/LavaUI/Theme.swift:300