small software-rendered rust tty
Diffstat (limited to 'src/colors.rs')
-rw-r--r--src/colors.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/colors.rs b/src/colors.rs
index 1a67947..effec8d 100644
--- a/src/colors.rs
+++ b/src/colors.rs
@@ -21,6 +21,10 @@ pub const FOUR: [[u8; 3]; 16] = [
[255, 255, 255],
];
+pub fn four(x: u16) -> [u8; 3] {
+ FOUR[x.min(0xf) as usize]
+}
+
pub const EIGHT: [[u8; 3]; 256] = [
[0, 0, 0],
[128, 0, 0],