summaryrefslogtreecommitdiff
path: root/crates/material_theme/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/material_theme/src/lib.rs11
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(),