summaryrefslogtreecommitdiff
path: root/crates/material_theme/src/radio.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-06-26 12:16:52 +0200
committerpml68 <contact@pml68.dev>2025-06-26 12:16:52 +0200
commit00c6cf80cb9c4587700078a062a6b32873b6f8ff (patch)
tree9aad054c784b51d4a0bc97c928b89da7dbcab863 /crates/material_theme/src/radio.rs
parentfeat: update for hot reloading support (diff)
downloadiced-builder-00c6cf80cb9c4587700078a062a6b32873b6f8ff.tar.gz
feat: extract `material_theme` into separate repo (`pml68/iced_material`)
Diffstat (limited to 'crates/material_theme/src/radio.rs')
-rw-r--r--crates/material_theme/src/radio.rs62
1 files changed, 0 insertions, 62 deletions
diff --git a/crates/material_theme/src/radio.rs b/crates/material_theme/src/radio.rs
deleted file mode 100644
index 7fb7a3f..0000000
--- a/crates/material_theme/src/radio.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-use iced_widget::core::{Background, Color};
-use iced_widget::radio::{Catalog, Status, Style, StyleFn};
-
-use super::Theme;
-use crate::utils::{HOVERED_LAYER_OPACITY, disabled_text, mix};
-
-impl Catalog for Theme {
- type Class<'a> = StyleFn<'a, Self>;
-
- fn default<'a>() -> Self::Class<'a> {
- Box::new(default)
- }
-
- fn style(&self, class: &Self::Class<'_>, status: Status) -> Style {
- class(self, status)
- }
-}
-
-pub fn default(theme: &Theme, status: Status) -> Style {
- let surface = theme.colors().surface;
- let primary = theme.colors().primary;
-
- let active = Style {
- background: Color::TRANSPARENT.into(),
- dot_color: primary.color,
- border_width: 1.0,
- border_color: primary.color,
- text_color: None,
- };
-
- match status {
- Status::Active { is_selected } => Style {
- border_color: if is_selected {
- active.border_color
- } else {
- surface.on_surface
- },
- ..active
- },
- Status::Hovered { is_selected } => Style {
- dot_color: mix(
- primary.color,
- surface.on_surface,
- HOVERED_LAYER_OPACITY,
- ),
- border_color: if is_selected {
- mix(primary.color, surface.on_surface, HOVERED_LAYER_OPACITY)
- } else {
- disabled_text(surface.on_surface)
- },
- background: Background::Color(if is_selected {
- Color {
- a: HOVERED_LAYER_OPACITY,
- ..surface.on_surface
- }
- } else {
- Color::TRANSPARENT
- }),
- ..active
- },
- }
-}