diff options
author | 2024-02-03 19:07:06 +0100 | |
---|---|---|
committer | 2024-02-03 19:07:06 +0100 | |
commit | 878134883e5298aa8e12261a3ebd85879eae1d19 (patch) | |
tree | fe8fcec55cce4d8ff74bbf234e1e250bc55bcc1c /core | |
parent | 6756594fc6edc699f8a254c369aabdecc4e2dcea (diff) | |
parent | ed02c1b24d22122e292b54950381589f29c5b21e (diff) | |
download | iced-878134883e5298aa8e12261a3ebd85879eae1d19.tar.gz iced-878134883e5298aa8e12261a3ebd85879eae1d19.tar.bz2 iced-878134883e5298aa8e12261a3ebd85879eae1d19.zip |
Merge pull request #2170 from varbhat/vbt/colorpalettes
Add Nord, Dracula, Solarized and Gruvbox themes
Diffstat (limited to 'core')
-rw-r--r-- | core/src/color.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/src/color.rs b/core/src/color.rs index 13077628..b8db322f 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -179,18 +179,18 @@ impl From<[f32; 4]> for Color { #[macro_export] macro_rules! color { ($r:expr, $g:expr, $b:expr) => { - $crate::Color::from_rgb8($r, $g, $b) + color!($r, $g, $b, 1.0) }; ($r:expr, $g:expr, $b:expr, $a:expr) => { - $crate::Color::from_rgba8($r, $g, $b, $a) + $crate::Color { + r: $r as f32 / 255.0, + g: $g as f32 / 255.0, + b: $b as f32 / 255.0, + a: $a, + } }; ($hex:expr) => {{ - let hex = $hex as u32; - let r = (hex & 0xff0000) >> 16; - let g = (hex & 0xff00) >> 8; - let b = (hex & 0xff); - - $crate::Color::from_rgb8(r as u8, g as u8, b as u8) + color!($hex, 1.0) }}; ($hex:expr, $a:expr) => {{ let hex = $hex as u32; @@ -198,7 +198,7 @@ macro_rules! color { let g = (hex & 0xff00) >> 8; let b = (hex & 0xff); - $crate::Color::from_rgba8(r as u8, g as u8, b as u8, $a) + color!(r, g, b, $a) }}; } |