summaryrefslogtreecommitdiffstats
path: root/style/src/theme
diff options
context:
space:
mode:
authorLibravatar Ian Douglas Scott <idscott@system76.com>2022-10-28 14:43:18 -0700
committerLibravatar Ian Douglas Scott <idscott@system76.com>2022-10-28 15:58:21 -0700
commitbe9cd3a09f4fb027786c634158ddeaca75a169f0 (patch)
tree3685a32b728bf6cfe426f46c437574f62a3d53db /style/src/theme
parent82217947aa80287282ed6deb02d238a31303e0d6 (diff)
downloadiced-be9cd3a09f4fb027786c634158ddeaca75a169f0.tar.gz
iced-be9cd3a09f4fb027786c634158ddeaca75a169f0.tar.bz2
iced-be9cd3a09f4fb027786c634158ddeaca75a169f0.zip
Use `once_cell` instead of `lazy_static`
This seems to be generally considered the preferred, idiomatic solution now. This is in the standard library behind a feature flag (apparently now called `std::sync::LazyLock`).
Diffstat (limited to 'style/src/theme')
-rw-r--r--style/src/theme/palette.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/style/src/theme/palette.rs b/style/src/theme/palette.rs
index 81aa9cc7..4fb5e4c8 100644
--- a/style/src/theme/palette.rs
+++ b/style/src/theme/palette.rs
@@ -1,6 +1,6 @@
use iced_core::Color;
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use palette::{FromColor, Hsl, Mix, RelativeContrast, Srgb};
#[derive(Debug, Clone, Copy, PartialEq)]
@@ -66,11 +66,10 @@ pub struct Extended {
pub danger: Danger,
}
-lazy_static! {
- pub static ref EXTENDED_LIGHT: Extended =
- Extended::generate(Palette::LIGHT);
- pub static ref EXTENDED_DARK: Extended = Extended::generate(Palette::DARK);
-}
+pub static EXTENDED_LIGHT: Lazy<Extended> =
+ Lazy::new(|| Extended::generate(Palette::LIGHT));
+pub static EXTENDED_DARK: Lazy<Extended> =
+ Lazy::new(|| Extended::generate(Palette::DARK));
impl Extended {
pub fn generate(palette: Palette) -> Self {