summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-02-03 19:07:06 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-03 19:07:06 +0100
commit878134883e5298aa8e12261a3ebd85879eae1d19 (patch)
treefe8fcec55cce4d8ff74bbf234e1e250bc55bcc1c /core
parent6756594fc6edc699f8a254c369aabdecc4e2dcea (diff)
parented02c1b24d22122e292b54950381589f29c5b21e (diff)
downloadiced-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.rs18
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)
}};
}