LavaUI docs GitHub

struct ButtonStyle

Swift

struct ButtonStyle

Colours and metrics for a Button.

Sources/LavaUI/Button.swift:91

Constructors

init(background: Color? = nil, hover: Color? = nil, pressed: Color? = nil, foreground: Color? = nil, disabledBackground: Color? = nil, disabledForeground: Color? = nil, cornerRadius: Float? = nil, padding: Float = 8, duration: Double = 0.12)

Creates a style. Any colour left nil comes from the current theme: panel at rest, hover under the pointer, accent pressed, and textPrimary / textSecondary for the label.

Sources/LavaUI/Button.swift:115

Properties

var background: Color

The fill at rest.

Sources/LavaUI/Button.swift:93

var cornerRadius: Float

Corner radius of the fill, in points.

Sources/LavaUI/Button.swift:105

var disabledBackground: Color

The fill while disabled.

Sources/LavaUI/Button.swift:101

var disabledForeground: Color

The label colour while disabled.

Sources/LavaUI/Button.swift:103

var duration: Double

How long the fill takes to reach a new state. Short enough to feel immediate; long enough to read as a transition rather than a jump.

Sources/LavaUI/Button.swift:110

var foreground: Color

The label colour.

Sources/LavaUI/Button.swift:99

var hover: Color

The fill under the pointer.

Sources/LavaUI/Button.swift:95

var padding: Float

Space between the label and the edge of the fill, on every side, in points.

Sources/LavaUI/Button.swift:107

var pressed: Color

The fill while pressed.

Sources/LavaUI/Button.swift:97