aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-07-31 13:40:49 +0200
committerpml68 <contact@pml68.dev>2025-07-31 13:40:49 +0200
commit4c9fb58fd20230eb9c604a7ca179485405023a67 (patch)
treea903fbd25e0dc9e549195a91d40ea5300bb4665f
parentfeat: make `button::styled` public (diff)
downloadiced_material-4c9fb58fd20230eb9c604a7ca179485405023a67.tar.gz
feat: impl `table::Catalog` for `Theme`
-rw-r--r--src/lib.rs1
-rw-r--r--src/table.rs25
2 files changed, 26 insertions, 0 deletions
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),
+ }
+}