summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Var Bhat <mailvarbhat@gmail.com>2023-12-22 02:08:36 +0530
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-03 18:25:03 +0100
commit6492d9d92793fca74adbc6aaaa8341e3ff4d37ab (patch)
treeb6b04ecde5362bdaaad8bd76aac7bdefc58dea5b /core
parent6756594fc6edc699f8a254c369aabdecc4e2dcea (diff)
downloadiced-6492d9d92793fca74adbc6aaaa8341e3ff4d37ab.tar.gz
iced-6492d9d92793fca74adbc6aaaa8341e3ff4d37ab.tar.bz2
iced-6492d9d92793fca74adbc6aaaa8341e3ff4d37ab.zip
make color! macro expand hex as Color directly
Diffstat (limited to 'core')
-rw-r--r--core/src/color.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/color.rs b/core/src/color.rs
index 13077628..ec352965 100644
--- a/core/src/color.rs
+++ b/core/src/color.rs
@@ -190,7 +190,12 @@ macro_rules! color {
let g = (hex & 0xff00) >> 8;
let b = (hex & 0xff);
- $crate::Color::from_rgb8(r as u8, g as u8, b as u8)
+ $crate::Color {
+ r: r as f32 / 255.0,
+ g: g as f32 / 255.0,
+ b: b as f32 / 255.0,
+ a: 1.0,
+ }
}};
($hex:expr, $a:expr) => {{
let hex = $hex as u32;