Initial + split from my custom roguelike engine

This commit is contained in:
2026-05-11 12:41:04 +02:00
commit 3b034714d8
5 changed files with 563 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
//! Palette-Presets.
/// RGB332-Palette: 8 Levels Rot, 8 Levels Grün, 4 Levels Blau.
///
/// Index-Bits: `RRRGGGBB` — `r = idx / 32`, `g = (idx / 4) % 8`, `b = idx % 4`.
pub const RGB332: [[u8; 3]; 256] = {
let mut p = [[0u8; 3]; 256];
let mut i = 0;
while i < 256 {
let r = (i / 32) as u32; // 0..=7
let g = ((i / 4) % 8) as u32; // 0..=7
let b = (i % 4) as u32; // 0..=3
p[i][0] = ((r * 255) / 7) as u8;
p[i][1] = ((g * 255) / 7) as u8;
p[i][2] = ((b * 255) / 3) as u8;
i += 1;
}
p
};