diff options
| author | Polesznyák Márk <contact@pml68.dev> | 2025-11-22 08:30:00 +0100 |
|---|---|---|
| committer | Polesznyák Márk <contact@pml68.dev> | 2025-11-22 08:30:00 +0100 |
| commit | ff7e17988d5868c72cfb39d09ccf4efb05d3ceda (patch) | |
| tree | 0734e0f409028e203532bfaea2c7372e2c646078 /src/container.rs | |
| parent | chore: add mailmap (diff) | |
| download | iced_material-ff7e17988d5868c72cfb39d09ccf4efb05d3ceda.tar.gz | |
feat!: combine `Primary`, `Secondary`, `Tertiary` and `Error`
Now only a singular `ColorQuartet` struct exists.
Also rename some `Surface` and `Inverse` fields for consistency.
Diffstat (limited to '')
| -rw-r--r-- | src/container.rs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/container.rs b/src/container.rs index 3b63d5f..5cda84d 100644 --- a/src/container.rs +++ b/src/container.rs @@ -27,7 +27,7 @@ pub fn primary(theme: &Theme) -> Style { Style { background: Some(Background::Color(primary.color)), - text_color: Some(primary.on_primary), + text_color: Some(primary.text), border: border::rounded(4), ..Style::default() } @@ -37,8 +37,8 @@ pub fn primary_container(theme: &Theme) -> Style { let primary = theme.colors().primary; Style { - background: Some(Background::Color(primary.primary_container)), - text_color: Some(primary.on_primary_container), + background: Some(Background::Color(primary.container)), + text_color: Some(primary.container_text), border: border::rounded(8), ..Style::default() } @@ -49,7 +49,7 @@ pub fn secondary(theme: &Theme) -> Style { Style { background: Some(Background::Color(secondary.color)), - text_color: Some(secondary.on_secondary), + text_color: Some(secondary.text), border: border::rounded(4), ..Style::default() } @@ -59,8 +59,8 @@ pub fn secondary_container(theme: &Theme) -> Style { let secondary = theme.colors().secondary; Style { - background: Some(Background::Color(secondary.secondary_container)), - text_color: Some(secondary.on_secondary_container), + background: Some(Background::Color(secondary.container)), + text_color: Some(secondary.container_text), border: border::rounded(8), ..Style::default() } @@ -71,7 +71,7 @@ pub fn tertiary(theme: &Theme) -> Style { Style { background: Some(Background::Color(tertiary.color)), - text_color: Some(tertiary.on_tertiary), + text_color: Some(tertiary.text), border: border::rounded(4), ..Style::default() } @@ -81,8 +81,8 @@ pub fn tertiary_container(theme: &Theme) -> Style { let tertiary = theme.colors().tertiary; Style { - background: Some(Background::Color(tertiary.tertiary_container)), - text_color: Some(tertiary.on_tertiary_container), + background: Some(Background::Color(tertiary.container)), + text_color: Some(tertiary.container_text), border: border::rounded(8), ..Style::default() } @@ -93,7 +93,7 @@ pub fn error(theme: &Theme) -> Style { Style { background: Some(Background::Color(error.color)), - text_color: Some(error.on_error), + text_color: Some(error.text), border: border::rounded(4), ..Style::default() } @@ -103,8 +103,8 @@ pub fn error_container(theme: &Theme) -> Style { let error = theme.colors().error; Style { - background: Some(Background::Color(error.error_container)), - text_color: Some(error.on_error_container), + background: Some(Background::Color(error.container)), + text_color: Some(error.container_text), border: border::rounded(8), ..Style::default() } @@ -115,7 +115,7 @@ pub fn surface(theme: &Theme) -> Style { Style { background: Some(Background::Color(surface.color)), - text_color: Some(surface.on_surface), + text_color: Some(surface.text), border: border::rounded(4), ..Style::default() } @@ -125,8 +125,8 @@ pub fn surface_container_lowest(theme: &Theme) -> Style { let surface = theme.colors().surface; Style { - background: Some(Background::Color(surface.surface_container.lowest)), - text_color: Some(surface.on_surface), + background: Some(Background::Color(surface.container.lowest)), + text_color: Some(surface.text), border: border::rounded(8), ..Style::default() } @@ -136,8 +136,8 @@ pub fn surface_container_low(theme: &Theme) -> Style { let surface = theme.colors().surface; Style { - background: Some(Background::Color(surface.surface_container.low)), - text_color: Some(surface.on_surface), + background: Some(Background::Color(surface.container.low)), + text_color: Some(surface.text), border: border::rounded(8), ..Style::default() } @@ -147,8 +147,8 @@ pub fn surface_container(theme: &Theme) -> Style { let surface = theme.colors().surface; Style { - background: Some(Background::Color(surface.surface_container.base)), - text_color: Some(surface.on_surface), + background: Some(Background::Color(surface.container.base)), + text_color: Some(surface.text), border: border::rounded(8), ..Style::default() } @@ -158,8 +158,8 @@ pub fn surface_container_high(theme: &Theme) -> Style { let surface = theme.colors().surface; Style { - background: Some(Background::Color(surface.surface_container.high)), - text_color: Some(surface.on_surface), + background: Some(Background::Color(surface.container.high)), + text_color: Some(surface.text), border: border::rounded(8), ..Style::default() } @@ -169,8 +169,8 @@ pub fn surface_container_highest(theme: &Theme) -> Style { let surface = theme.colors().surface; Style { - background: Some(Background::Color(surface.surface_container.highest)), - text_color: Some(surface.on_surface), + background: Some(Background::Color(surface.container.highest)), + text_color: Some(surface.text), border: border::rounded(8), ..Style::default() } @@ -181,7 +181,7 @@ pub fn inverse_surface(theme: &Theme) -> Style { Style { background: Some(Background::Color(inverse.inverse_surface)), - text_color: Some(inverse.inverse_on_surface), + text_color: Some(inverse.inverse_surface_text), border: border::rounded(4), ..Style::default() } |
