Theme
An app's colours for light and dark, installed once, and the gradient pairs the derived square picks from. Nothing draws a colour it did not ask the theme for.
Desktop
arkui::theme


Every picture on this site is drawn twice, in iced's light and dark themes with arkui's neutral palette, and the page shows the one its own theme is in.
arkui::theme
An app's palette, installed once: light and dark iced palettes and the derived square's gradient pairs for each. Every style closure asks of(theme) rather than writing a colour down, which is why dark mode works.
Palette { light, dark, light_art, dark_art }Palette::NEUTRALinstall(palette) -> boolpalette()of(&Theme) -> &Extendedis_dark(&Theme)art(&Theme)
Rules
- Install before the first frame; a second install is refused, so one window has one answer to "what colour is this".
- NEUTRAL (AppKit greys, system blue) is the only colour arkui owns. The docs' pictures are drawn in it.
Mobile
Where
ui/Theme.kt: ArkTheme, LocalArkTheme, Space
How
- Inside a MaterialTheme, provide LocalArkTheme with ArkTheme(art): the derived square's pairs, ArkTheme.NeutralLight and NeutralDark until an app gives its own.
- Space.xs … Space.xxl, Space.page, Space.corner: the spacing every shared component lays out by.
Where
swift/ArkUI: Space, Squares, \.squares, Color(light:dark:)
How
- import ArkUI. Space.xs … Space.xxl, Space.page, Space.corner: the spacing, Android's.
- Set the derived square's colours once at the root: .environment(\.squares, Squares(light:dark:)); Squares.neutral until an app does.