Create colours module with colour definitions

This commit is contained in:
cdo committed 2026-10-30 11:13:07 +00:00
1 parent 7f29c5abbb
commit f25e9a00a8
4 files changed
+25 -23

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use crate::*;
macro_rules! hex {
( $value:literal ) => {
image::SRGBA {
r: (($value >> 16) & 0xff) as f32 / 255.0,
g: (($value >> 8) & 0xff) as f32 / 255.0,
b: ($value & 0xff) as f32 / 255.0,
a: 1.0,
}
}
}
pub const BLACK: image::SRGBA = hex!(0x000000);
pub const RED: image::SRGBA = hex!(0xff0000);
pub const GREEN: image::SRGBA = hex!(0x00ff00);
pub const BLUE: image::SRGBA = hex!(0x0000ff);
pub const CYAN: image::SRGBA = hex!(0x00ffff);
pub const MAGENTA: image::SRGBA = hex!(0xff00ff);
pub const YELLOW: image::SRGBA = hex!(0xffff00);
pub const WHITE: image::SRGBA = hex!(0xffffff);