iOS and iPadOS
iOS theming
Light, dark and high-contrast themes in StanceUI: system detection, Increase Contrast, persistence, scoped themes and Dynamic Type.
The three Stance themes are available on iOS from the same token source as the web. The preference is a StanceAppearance: system, light, dark or high contrast.
- System follows the device colour scheme. Increase Contrast selects the high-contrast theme.
- High contrast is a complete theme with full-strength boundaries, 7:1 text, thicker focus rings and outlines in place of shadows.
- The preference is stored in UserDefaults under
stance-theme, with the same values the web uses.
Reading the theme
@Environment(\.stanceTheme) private var theme
Text("Deployed")
.foregroundStyle(theme.colors.fgMuted)
.padding(StanceSpacing.md)
.background(theme.colors.bgSurface)Colours are semantic roles named like the web roles, such as bgSurface and fgMuted.
Letting people choose
@AppStorage(StanceAppearance.storageKey)
private var appearance = StanceAppearance.system.rawValueScoped themes
PromoCard().stanceScopedTheme(.dark)Typography and Dynamic Type
Every text style scales with Dynamic Type, up to the largest accessibility sizes. The default typeface is the system font. To use DM Sans, bundle the font in your app and pass its name:
StanceThemeProvider(fontFamily: "DM Sans") { RootView() }Motion
Durations and easing come from the tokens. Stance animations are skipped when Reduce Motion is on.