From 4c9fb58fd20230eb9c604a7ca179485405023a67 Mon Sep 17 00:00:00 2001 From: pml68 Date: Thu, 31 Jul 2025 13:40:49 +0200 Subject: feat: impl `table::Catalog` for `Theme` --- src/lib.rs | 1 + src/table.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/table.rs (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index a1c582d..9e68ba0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ pub mod scrollable; pub mod slider; #[cfg(feature = "svg")] pub mod svg; +pub mod table; pub mod text; pub mod text_editor; pub mod text_input; diff --git a/src/table.rs b/src/table.rs new file mode 100644 index 0000000..c5c6e5d --- /dev/null +++ b/src/table.rs @@ -0,0 +1,25 @@ +use iced_widget::core::Background; +use iced_widget::table::{Catalog, Style, StyleFn}; + +use super::Theme; + +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<'_>) -> Style { + class(self) + } +} + +pub fn default(theme: &Theme) -> Style { + let separator = theme.colors().outline.variant; + + Style { + separator_x: Background::Color(separator), + separator_y: Background::Color(separator), + } +} -- cgit v1.2.3