summaryrefslogtreecommitdiff
path: root/crates/material_theme/src
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-04-26 13:17:58 +0200
committerpml68 <contact@pml68.dev>2025-04-26 13:17:58 +0200
commit3bdd724119eb2dbcb2480e441cd13f82575c6536 (patch)
tree7db73d04dbb0c2f2450292b102e5c761af94cbaa /crates/material_theme/src
parentfeat(material_theme): create an iced `Palette` for `iced::theme::Base` impl (diff)
downloadiced-builder-3bdd724119eb2dbcb2480e441cd13f82575c6536.tar.gz
feat(material_theme): implement `image::Catalog` (under feature flag)
Diffstat (limited to '')
-rw-r--r--crates/material_theme/src/image.rs21
-rw-r--r--crates/material_theme/src/lib.rs2
2 files changed, 23 insertions, 0 deletions
diff --git a/crates/material_theme/src/image.rs b/crates/material_theme/src/image.rs
new file mode 100644
index 0000000..de5942a
--- /dev/null
+++ b/crates/material_theme/src/image.rs
@@ -0,0 +1,21 @@
+use iced_widget::core::{Background, Border, Color, border};
+use iced_widget::image::{Catalog, Style, StyleFn};
+
+use super::Theme;
+use crate::utils::{elevation, shadow_from_elevation};
+
+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 {
+ Style::default()
+}
diff --git a/crates/material_theme/src/lib.rs b/crates/material_theme/src/lib.rs
index 569b06c..1b4f90e 100644
--- a/crates/material_theme/src/lib.rs
+++ b/crates/material_theme/src/lib.rs
@@ -9,6 +9,8 @@ pub mod combo_box;
pub mod container;
#[cfg(feature = "dialog")]
pub mod dialog;
+#[cfg(feature = "image")]
+pub mod image;
#[cfg(feature = "markdown")]
pub mod markdown;
pub mod menu;