Skip to main content

Color, border and radius sugar

Short helpers for colors, border widths and corner radii.

Example​

static void styled_box(void) {
Column("Box", .backgroundColor = ColorHex(0x1E1E22),
.overlayColor = ColorHexA(0x00000020),
.border = { .color = Color(80, 84, 92, 255), .width = BorderAll(1) },
.cornerRadius = RadiusTopBottom(8, 0),
.layout = { .padding = PadAll(12) }) {
Text("Rounded top, flat bottom");
}
}

Reference​

NameFormWhat it doesPage
ColorColor(r, g, b, a)Color from 0 to 255 channels.Styling
ColorHexColorHex(0xRRGGBB)Opaque color from a hex literal.Styling
ColorHexAColorHexA(0xRRGGBBAA)Color with alpha from a hex literal.Styling
BorderAllBorderAll(n)n px on every side.Styling
BorderSymmetricBorderSymmetric(h, v)h left and right, v top and bottom.Styling
BorderOnlyBorderOnly(.left = 1, .betweenChildren = 1)Per side, plus dividers between children.Styling
RadiusAllRadiusAll(n)Every corner. A large value makes a pill.Styling
RadiusTopBottomRadiusTopBottom(t, b)Top corners t, bottom corners b.Styling
RadiusLeftRightRadiusLeftRight(l, r)Left corners l, right corners r.Styling
RadiusOnlyRadiusOnly(.topLeft = 8)Per corner. Unset corners are 0.Styling