ThemeColors
public struct ThemeColors
A struct that defines all semantic colors used across the UI theme.
Colors follow the Material Design 3 specification and are resolved from a Theme.
These values can be accessed via environment using @Environment(\.appTheme).colors
or via subscript using a ColorToken.
-
Primary brand color. Used for filled buttons, toggles, sliders, and active states.
Declaration
Swift
public let primary: Color -
Foreground color for content displayed on top of the primary color. Used in filled buttons, icons, and text on
primary.Declaration
Swift
public let onPrimary: Color -
A container version of
primary. Used for tonal buttons and cards.Declaration
Swift
public let primaryContainer: Color -
Foreground color for content on
primaryContainer.Declaration
Swift
public let onPrimaryContainer: Color
-
Secondary brand color. Used for complementary accents and UI elements.
Declaration
Swift
public let secondary: Color -
Foreground color on
secondary.Declaration
Swift
public let onSecondary: Color -
Container version of
secondary. Used in tonal buttons and backgrounds.Declaration
Swift
public let secondaryContainer: Color -
Foreground color for content on
secondaryContainer.Declaration
Swift
public let onSecondaryContainer: Color
-
Tertiary color used for less prominent accents and optional areas of UI.
Declaration
Swift
public let tertiary: Color -
Foreground color on
tertiary.Declaration
Swift
public let onTertiary: Color -
Container version of
tertiary. Often used in tertiary or tonal button variants.Declaration
Swift
public let tertiaryContainer: Color -
Foreground color for content on
tertiaryContainer.Declaration
Swift
public let onTertiaryContainer: Color
-
General background color for screens and surfaces.
Declaration
Swift
public let background: Color -
Foreground color for content placed directly on the background.
Declaration
Swift
public let onBackground: Color
-
The error color used to indicate critical states or invalid input. Used in buttons with role
.destructive, text field error states, etc.Declaration
Swift
public let error: Color -
Foreground color for content on top of the
errorcolor.Declaration
Swift
public let onError: Color -
Container version of
error. Used in buttons, alerts, and error highlights.Declaration
Swift
public let errorContainer: Color -
Foreground color for content on
errorContainer.Declaration
Swift
public let onErrorContainer: Color
-
Surface color used for inverse components (e.g., bottom sheets, overlays).
Declaration
Swift
public let inverseSurface: Color -
Foreground color used on top of
inverseSurface.Declaration
Swift
public let inverseOnSurface: Color -
Primary brand color adapted for use on inverse surfaces.
Declaration
Swift
public let inversePrimary: Color
-
Base surface color. Used for cards, sheets, dialogs, and containers.
Declaration
Swift
public let surface: Color -
Foreground content (text, icons) on top of
surface.Declaration
Swift
public let onSurface: Color -
A variant of the surface used for borders, dividers, and low-emphasis backgrounds.
Declaration
Swift
public let surfaceVariant: Color -
Foreground color for content on
surfaceVariant.Declaration
Swift
public let onSurfaceVariant: Color -
Used for dimmed surface backgrounds (e.g., navigation bars or background states).
Declaration
Swift
public let surfaceDim: Color -
Used for bright surface states (e.g., elevated containers).
Declaration
Swift
public let surfaceBright: Color -
The lowest elevation container surface (typically full-white or full-black).
Declaration
Swift
public let surfaceContainerLowest: Color -
Low-elevation container surface (1dp–2dp).
Declaration
Swift
public let surfaceContainerLow: Color -
Medium-elevation container surface (3dp–4dp).
Declaration
Swift
public let surfaceContainer: Color -
High-elevation container surface (6dp–8dp).
Declaration
Swift
public let surfaceContainerHigh: Color -
Highest-elevation container surface (above 8dp).
Declaration
Swift
public let surfaceContainerHighest: Color
-
Used for strokes, borders, and outlines (1dp emphasis).
Declaration
Swift
public let outline: Color -
A lower-contrast version of
outline. Used for less prominent borders or visual separation.Declaration
Swift
public let outlineVariant: Color -
Used to block interaction (e.g., modal scrims or overlays).
Declaration
Swift
public let scrim: Color -
The shadow color used in elevation and shadow rendering.
Declaration
Swift
public let shadow: Color -
Undocumented
Declaration
Swift
public static let defaultLight: ThemeColors -
Undocumented
Declaration
Swift
public static let defaultDark: ThemeColors -
init(primary:onPrimary: primaryContainer: onPrimaryContainer: secondary: onSecondary: secondaryContainer: onSecondaryContainer: tertiary: onTertiary: tertiaryContainer: onTertiaryContainer: background: onBackground: error: onError: errorContainer: onErrorContainer: inverseSurface: inverseOnSurface: inversePrimary: surface: onSurface: surfaceVariant: onSurfaceVariant: surfaceDim: surfaceBright: surfaceContainerLowest: surfaceContainerLow: surfaceContainer: surfaceContainerHigh: surfaceContainerHighest: outline: outlineVariant: scrim: shadow: ) Undocumented
Declaration
Swift
public init( primary: Color, onPrimary: Color, primaryContainer: Color, onPrimaryContainer: Color, secondary: Color, onSecondary: Color, secondaryContainer: Color, onSecondaryContainer: Color, tertiary: Color, onTertiary: Color, tertiaryContainer: Color, onTertiaryContainer: Color, background: Color, onBackground: Color, error: Color, onError: Color, errorContainer: Color, onErrorContainer: Color, inverseSurface: Color, inverseOnSurface: Color, inversePrimary: Color, surface: Color, onSurface: Color, surfaceVariant: Color, onSurfaceVariant: Color, surfaceDim: Color, surfaceBright: Color, surfaceContainerLowest: Color, surfaceContainerLow: Color, surfaceContainer: Color, surfaceContainerHigh: Color, surfaceContainerHighest: Color, outline: Color, outlineVariant: Color, scrim: Color, shadow: Color ) -
copy(primary:onPrimary: primaryContainer: onPrimaryContainer: secondary: onSecondary: secondaryContainer: onSecondaryContainer: tertiary: onTertiary: tertiaryContainer: onTertiaryContainer: background: onBackground: error: onError: errorContainer: onErrorContainer: inverseSurface: inverseOnSurface: inversePrimary: surface: onSurface: surfaceVariant: onSurfaceVariant: surfaceDim: surfaceBright: surfaceContainerLowest: surfaceContainerLow: surfaceContainer: surfaceContainerHigh: surfaceContainerHighest: outline: outlineVariant: scrim: shadow: ) Returns a new
ThemeColorsinstance by copying the current one and applying the specified overrides.Only parameters you pass will be changed — others will retain existing values.
Declaration
Swift
func copy( primary: Color? = nil, onPrimary: Color? = nil, primaryContainer: Color? = nil, onPrimaryContainer: Color? = nil, secondary: Color? = nil, onSecondary: Color? = nil, secondaryContainer: Color? = nil, onSecondaryContainer: Color? = nil, tertiary: Color? = nil, onTertiary: Color? = nil, tertiaryContainer: Color? = nil, onTertiaryContainer: Color? = nil, background: Color? = nil, onBackground: Color? = nil, error: Color? = nil, onError: Color? = nil, errorContainer: Color? = nil, onErrorContainer: Color? = nil, inverseSurface: Color? = nil, inverseOnSurface: Color? = nil, inversePrimary: Color? = nil, surface: Color? = nil, onSurface: Color? = nil, surfaceVariant: Color? = nil, onSurfaceVariant: Color? = nil, surfaceDim: Color? = nil, surfaceBright: Color? = nil, surfaceContainerLowest: Color? = nil, surfaceContainerLow: Color? = nil, surfaceContainer: Color? = nil, surfaceContainerHigh: Color? = nil, surfaceContainerHighest: Color? = nil, outline: Color? = nil, outlineVariant: Color? = nil, scrim: Color? = nil, shadow: Color? = nil ) -> ThemeColors