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
| Name | Form | What it does | Page |
|---|---|---|---|
Color | Color(r, g, b, a) | Color from 0 to 255 channels. | Styling |
ColorHex | ColorHex(0xRRGGBB) | Opaque color from a hex literal. | Styling |
ColorHexA | ColorHexA(0xRRGGBBAA) | Color with alpha from a hex literal. | Styling |
BorderAll | BorderAll(n) | n px on every side. | Styling |
BorderSymmetric | BorderSymmetric(h, v) | h left and right, v top and bottom. | Styling |
BorderOnly | BorderOnly(.left = 1, .betweenChildren = 1) | Per side, plus dividers between children. | Styling |
RadiusAll | RadiusAll(n) | Every corner. A large value makes a pill. | Styling |
RadiusTopBottom | RadiusTopBottom(t, b) | Top corners t, bottom corners b. | Styling |
RadiusLeftRight | RadiusLeftRight(l, r) | Left corners l, right corners r. | Styling |
RadiusOnly | RadiusOnly(.topLeft = 8) | Per corner. Unset corners are 0. | Styling |