Colors and materials
Build adaptive colors, gradients, and native blurred surfaces.
Visual properties such as Background accept a Brush. A Color converts to a solid brush automatically, so ordinary surfaces remain concise:
On a ContentView, Background fills the complete page beneath safe areas and translucent bars. SafeAreaEdges controls the page content's layout without clipping a color, gradient, or material assigned to the page itself.
Semantic colors
Prefer Colors.Label, SecondaryLabel, Background, SecondaryBackground, GroupedBackground, Separator, and the system accent colors. UIKit resolves them for light/dark appearance, increased contrast, and vibrancy.
Create an explicit adaptive color when the design has its own pair:
Color.FromBytes accepts 8-bit channels. Color.FromHex accepts 0xRRGGBB or 0xAARRGGBB. Colors.Transparent is fully transparent. WithAlpha returns a copy with another opacity while preserving system colors and explicit light/dark variants. When a gradient or animation fades a color away, use color.WithAlpha(0) so its RGB channels interpolate from that color instead of transparent black.
Map applies a transformation to each appearance variant: dynamic colors are transformed per variant and stay dynamic, flat colors are transformed directly, and system colors keep their UIKit resolution. Derive states such as a pressed highlight from a baseline color:
When the appearances need different treatment, pass one transform per appearance: Map(light => …, dark => …). That overload always returns a dynamic color, so a flat baseline gains variants.
Gradients
Gradient coordinates use unit space by default: (0, 0) is the top-leading corner and (1, 1) is bottom-trailing. LinearGradient.Vertical(...) and Horizontal(...) spread colors evenly.
Set Units to GradientUnits.Points to use UIKit points from the view's top-left origin instead. This keeps a fade at a fixed width as the view resizes:
Underlay paints a solid color beneath translucent stops, so the fade remains opaque over the row background.
Animations can interpolate two gradients when they have the same number of stops, the same Units, and both use interpolatable custom colors. System colors, materials, or incompatible gradients change without an in-between value.
Materials
Material uses UIKit's native blurred surfaces:
Available thicknesses run from UltraThin through Chrome. Glass uses the interactive Liquid Glass material on iOS 26 and falls back to Chrome on earlier supported versions. Materials reveal whatever is rendered behind them, so place them in an Overlay rather than over an opaque parent.
See overlay and border for surface composition, and surfaces and transforms for clipping and elevation.