summaryrefslogtreecommitdiff
path: root/src/theme/text.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-03-30 20:16:48 +0200
committerpml68 <contact@pml68.dev>2025-04-15 23:46:01 +0200
commitbbc151e82b86bf2d7114f0ea05cde7e8858ba610 (patch)
tree0a84e9d2d251c475bbdfe646b0855f965bb718b0 /src/theme/text.rs
parentfeat: add custom theme struct with dark and light variants (diff)
downloadiced-builder-bbc151e82b86bf2d7114f0ea05cde7e8858ba610.tar.gz
feat: add shadow color, impl `button::Catalog` and `text::Catalog`
Diffstat (limited to '')
-rw-r--r--src/theme/text.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/theme/text.rs b/src/theme/text.rs
new file mode 100644
index 0000000..9cbd056
--- /dev/null
+++ b/src/theme/text.rs
@@ -0,0 +1,50 @@
+#![allow(dead_code)]
+use iced::widget::text::{Catalog, Style, StyleFn};
+
+use super::OtherTheme;
+
+impl Catalog for OtherTheme {
+ type Class<'a> = StyleFn<'a, Self>;
+
+ fn default<'a>() -> Self::Class<'a> {
+ Box::new(none)
+ }
+
+ fn style(&self, class: &Self::Class<'_>) -> Style {
+ class(self)
+ }
+}
+
+pub fn none(_: &OtherTheme) -> Style {
+ Style { color: None }
+}
+
+pub fn primary(theme: &OtherTheme) -> Style {
+ Style {
+ color: Some(theme.colorscheme.primary.on_primary),
+ }
+}
+
+pub fn secondary(theme: &OtherTheme) -> Style {
+ Style {
+ color: Some(theme.colorscheme.secondary.on_secondary),
+ }
+}
+
+pub fn tertiary(theme: &OtherTheme) -> Style {
+ Style {
+ color: Some(theme.colorscheme.tertiary.on_tertiary),
+ }
+}
+
+pub fn error(theme: &OtherTheme) -> Style {
+ Style {
+ color: Some(theme.colorscheme.error.on_error),
+ }
+}
+
+pub fn surface(theme: &OtherTheme) -> Style {
+ Style {
+ color: Some(theme.colorscheme.surface.on_surface),
+ }
+}