diff options
| author | pml68 <contact@pml68.dev> | 2025-05-15 23:58:28 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-05-15 23:58:28 +0200 |
| commit | 936293bb8f8d12df58f9f4e6ce865b87e08afd83 (patch) | |
| tree | 7de0eaeb0d8782b944461c434b663ac914192d16 | |
| parent | ci: allow `clippy::uninlined_format_args` (diff) | |
| download | iced-builder-936293bb8f8d12df58f9f4e6ce865b87e08afd83.tar.gz | |
feat(material_theme): add `new_const` method to `Theme`
Diffstat (limited to '')
| -rw-r--r-- | crates/material_theme/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/material_theme/src/lib.rs b/crates/material_theme/src/lib.rs index e59e1e9..6853931 100644 --- a/crates/material_theme/src/lib.rs +++ b/crates/material_theme/src/lib.rs @@ -69,6 +69,17 @@ impl Theme { }) } + pub const fn new_const( + name: &'static str, + colorscheme: ColorScheme, + ) -> Self { + Self::Custom(Custom { + name: Cow::Borrowed(name), + is_dark: lightness(colorscheme.surface.color) <= 0.5, + colorscheme, + }) + } + pub fn name(&self) -> Cow<'static, str> { match self { Self::Dark => "Dark".into(), |
