LavaUI docs GitHub

struct WindowControlsStyle

Swift

struct WindowControlsStyle

Colours and metrics for a control cluster.

The defaults are the traffic lights, because they are the arrangement users already read without a legend: the colour says which button it is at a glance and at any size, and the glyph is confirmation rather than the label. Every field is open, so an app whose palette this fights can restate it without reimplementing hit testing or the compositor calls.

Sources/LavaUI/WindowControls.swift:157

Constructors

init(size: Float = 12, spacing: Float = 8, close: Color = Color(r: 1.0, g: 0.37, b: 0.34), minimize: Color = Color(r: 1.0, g: 0.74, b: 0.18), maximize: Color = Color(r: 0.16, g: 0.78, b: 0.25), pressedDim: Float = 0.75, glyph: Color = Color(r: 0.15, g: 0.12, b: 0.1, a: 0.85), glyphOnHoverOnly: Bool = true)

Creates a style. The defaults are red, amber and green circles 12 points across.

Sources/LavaUI/WindowControls.swift:178

Properties

var close: Color

Fill of the close control.

Sources/LavaUI/WindowControls.swift:163

var glyph: Color

The glyph drawn inside a control while the cluster is hovered.

Sources/LavaUI/WindowControls.swift:172

var glyphOnHoverOnly: Bool

Whether the glyphs appear only on hover. False draws them always, which suits a dense toolbar where the cluster is small.

Sources/LavaUI/WindowControls.swift:175

var maximize: Color

Fill of the maximize control.

Sources/LavaUI/WindowControls.swift:167

var minimize: Color

Fill of the minimize control.

Sources/LavaUI/WindowControls.swift:165

var pressedDim: Float

Fill while the pointer is down on a control. A darkened version of the control's own colour reads as "pressed" without a second palette.

Sources/LavaUI/WindowControls.swift:170

var size: Float

Diameter of one control, in points.

Sources/LavaUI/WindowControls.swift:159

var spacing: Float

Gap between controls.

Sources/LavaUI/WindowControls.swift:161

Methods

static func monochrome(size: Float = 12, spacing: Float = 8, color: Color? = nil) -> WindowControlsStyle

One flat colour for all three, for chrome that would rather not shout. The glyph still says which is which, so it is drawn unconditionally.

Sources/LavaUI/WindowControls.swift:200