Palette
ThePalette struct defines the six core colors of a theme. An Extended palette automatically generates variations of these colors for different widget states.
Base Palette
Core Colors
- background: The base background color of your application
- text: The default text color
- primary: The primary accent color (for buttons, links, etc.)
- success: Color for successful operations (typically green)
- warning: Color for warnings (typically yellow/orange)
- danger: Color for errors and dangerous actions (typically red)
Built-in Palettes
Each built-in theme has a corresponding palette constant:Extended Palette
TheExtended struct provides an expanded set of colors derived from the base palette:
Generating Extended Palettes
Color Pair
Color Categories
Background
Primary
Secondary
Success, Warning, Danger
Color Utilities
Lightening and Darkening
Color Mixing
a, 1.0 returns b, 0.5 is halfway.
Readability
true if the color is considered dark (lightness < 0.6 in Oklch color space).
Examples
Accessing Palette Colors
Using Extended Colors
Creating a Custom Palette
Using Color Utilities
Styling with Extended Palette
Semantic Color Usage
Dynamic Color Generation
Color Science
Iced uses the Oklch color space for color manipulations. Oklch is perceptually uniform, meaning:- Equal numeric changes produce equal perceptual changes
- Colors maintain their hue when lightened or darkened
- Color mixing produces intuitive results
See Also
- Theme Overview - Theme system concepts
- Built-in Themes - All available themes
- Custom Themes - Creating custom themes
- Color - Core Color type
