Skip to main content

Shadow

Shadow gives an element a soft drop shadow that follows its corner radius. Set it on the element's .custom field.

Example​

static void raised_card(void) {
Column("Card", .layout = { .padding = PadAll(16) },
.backgroundColor = ColorHex(0x2A2D34),
.cornerRadius = RadiusAll(8),
.custom = Shadow(.offset = { 0, 4 }, .blur = 12)) {
Text("Floating above the page");
}
}

Reference​

NameFormWhat it doesPage
Shadow.custom = Shadow(.offset, .blur, .spread, .color)Drop shadow behind an element, following its .cornerRadius. Default color Color(0,0,0,64). Can't share an element with a Draw callback.Styling
CC_ShadowOptsstruct { CC_Vector2 offset; float blur; float spread; CC_Color color; }Fields for Shadow.Styling
CC_ShadowCC_CustomElementConfig (CC_ShadowOpts opts)What Shadow calls.
CC_ShadowSlot, CC_SHADOW_TAG, CC_SHADOW_POOL_SIZEPool entry, its render tag (-2), and pool size (128 per frame). For custom renderers.Styling