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/table.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/table.rs (limited to 'src/table.rs') 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