make color! macro expand hex as Color directly
This commit is contained in:
parent
6756594fc6
commit
6492d9d927
1 changed files with 6 additions and 1 deletions
|
|
@ -190,7 +190,12 @@ macro_rules! color {
|
||||||
let g = (hex & 0xff00) >> 8;
|
let g = (hex & 0xff00) >> 8;
|
||||||
let b = (hex & 0xff);
|
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) => {{
|
($hex:expr, $a:expr) => {{
|
||||||
let hex = $hex as u32;
|
let hex = $hex as u32;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue