dev/prometeuc-improvements (#5)
Co-authored-by: Nilton Constantino <nilton.constantino@visma.com> Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
@@ -60,4 +60,14 @@ impl Color {
|
||||
pub const fn raw(self) -> u16 {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub const fn hex(self) -> i32 {
|
||||
let (r5, g6, b5) = Self::unpack_to_native(self.0);
|
||||
let r8 = ((r5 as u32) << 3) | ((r5 as u32) >> 2);
|
||||
let g8 = ((g6 as u32) << 2) | ((g6 as u32) >> 4);
|
||||
let b8 = ((b5 as u32) << 3) | ((b5 as u32) >> 2);
|
||||
let hex = r8 << 16 | g8 << 8 | b8;
|
||||
hex as i32
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user