diff options
Diffstat (limited to 'core/src')
-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) }}; } |