arkui

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

The palette's colours, then the derived square's pairs, picked by name.The palette's colours, then the derived square's pairs, picked by name.
The palette's colours, then the derived square's pairs, picked by name.

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.

Rules

rust/arkui/src/theme.rs

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.