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)
Not documented.
Sources/LavaUI/Theme.swift:68
Properties
var accent: Color
Emphasis for headings and focus rings.
Sources/LavaUI/Theme.swift:33
var background: Color
Window background, behind everything.
Sources/LavaUI/Theme.swift:39
var border: Color
Not documented.
Sources/LavaUI/Theme.swift:52
var borderWidth: Float
Not documented.
Sources/LavaUI/Theme.swift:53
static var builtIns: [BuiltIn] { get }
Palettes the system theme understands, in the order Settings lists them.
Sources/LavaUI/Theme.swift:258
var canvas: Color
The diagram canvas.
Sources/LavaUI/Theme.swift:45
var caretWidth: Float
Not documented.
Sources/LavaUI/Theme.swift:60
var controlPadding: Float
Inner padding for controls such as text fields.
Sources/LavaUI/Theme.swift:57
var cornerRadius: Float
Default corner radius for panels and controls. 0 gives hard corners.
Sources/LavaUI/Theme.swift:55
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:274
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:105
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:173
var focusRingColor: Color?
Focus ring colour. nil uses accent.
Sources/LavaUI/Theme.swift:66
var focusRingStyle: FocusRingStyle
Shape of the focused-field chrome. Defaults to a full rounded outline.
Sources/LavaUI/Theme.swift:62
var focusRingWidth: Float
Stroke thickness for the focus ring (also used by .underline).
Sources/LavaUI/Theme.swift:64
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:229
var hover: Color
Row highlight under the pointer.
Sources/LavaUI/Theme.swift:47
var inset: Color
Inset surfaces: text fields, wells.
Sources/LavaUI/Theme.swift:43
static let light: Theme
Not documented.
Sources/LavaUI/Theme.swift:121
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:191
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:151
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:289
var panel: Color
Side panels and other raised chrome.
Sources/LavaUI/Theme.swift:41
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:210
var selected: Color
Current selection in a list — deliberately distinct from accent.
Sources/LavaUI/Theme.swift:35
var selectionFill: Color
Text selection highlight.
Sources/LavaUI/Theme.swift:49
var stackSpacing: Float
Default distance between adjacent views in a stack when its spacing is nil.
Sources/LavaUI/Theme.swift:59
var textDim: Color
Not documented.
Sources/LavaUI/Theme.swift:31
var textMuted: Color
Not documented.
Sources/LavaUI/Theme.swift:30
var textPrimary: Color
Not documented.
Sources/LavaUI/Theme.swift:28
var textSecondary: Color
Not documented.
Sources/LavaUI/Theme.swift:29
Methods
static func named(_ name: String) -> Theme?
The names the compositor's system theme understands.
Sources/LavaUI/Theme.swift:281