From dac7e82e0bff128097653fe05829b2d576fcdb2f Mon Sep 17 00:00:00 2001 From: pml68 Date: Mon, 28 Apr 2025 10:56:49 +0200 Subject: refactor(material_theme)!: make `Theme` an enum with `Custom` variant --- crates/material_theme/src/radio.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'crates/material_theme/src/radio.rs') diff --git a/crates/material_theme/src/radio.rs b/crates/material_theme/src/radio.rs index d249413..7fb7a3f 100644 --- a/crates/material_theme/src/radio.rs +++ b/crates/material_theme/src/radio.rs @@ -2,7 +2,7 @@ use iced_widget::core::{Background, Color}; use iced_widget::radio::{Catalog, Status, Style, StyleFn}; use super::Theme; -use crate::utils::{DISABLED_TEXT_OPACITY, HOVERED_LAYER_OPACITY, mix}; +use crate::utils::{HOVERED_LAYER_OPACITY, disabled_text, mix}; impl Catalog for Theme { type Class<'a> = StyleFn<'a, Self>; @@ -17,8 +17,8 @@ impl Catalog for Theme { } pub fn default(theme: &Theme, status: Status) -> Style { - let surface = theme.colorscheme.surface; - let primary = theme.colorscheme.primary; + let surface = theme.colors().surface; + let primary = theme.colors().primary; let active = Style { background: Color::TRANSPARENT.into(), @@ -46,10 +46,7 @@ pub fn default(theme: &Theme, status: Status) -> Style { border_color: if is_selected { mix(primary.color, surface.on_surface, HOVERED_LAYER_OPACITY) } else { - Color { - a: DISABLED_TEXT_OPACITY, - ..surface.on_surface - } + disabled_text(surface.on_surface) }, background: Background::Color(if is_selected { Color { -- cgit v1.2.3