Skip to main content
.colorScheme(scheme: "light" | "dark"): Component;

Parameters

scheme
"light" | "dark"
The color scheme to apply. Either “light” for light mode or “dark” for dark mode.

Support

Usage

Force light mode

VStack([
    Text("Always light mode"),
    Button("Light Button", () => {})
]).colorScheme("light")

Force dark mode

VStack([
    Text("Always dark mode"),
    Rectangle().fill(Color("primary"))
]).colorScheme("dark")