From e2756ec60bee792178661402a9d535e8b32f3f1f Mon Sep 17 00:00:00 2001 From: Juergen Stuber Date: Sat, 9 Nov 2024 12:05:54 +0100 Subject: [PATCH] Change color to amber --- src/bin/primes/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/primes/main.rs b/src/bin/primes/main.rs index 09cdb4f..1622e14 100644 --- a/src/bin/primes/main.rs +++ b/src/bin/primes/main.rs @@ -12,11 +12,12 @@ use lowdim::Array2d; use lowdim::BBox2d; use lowdim::Point2d; +use pixelfoo::color::Color; + type Error = Box; type Result = std::result::Result; -const COLORS: usize = 4; -const WHITE_VALUE: u8 = 128; +const COLORS: usize = 3; #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum Pixel { @@ -47,12 +48,11 @@ fn send(w: &mut T, frame: &Frame) -> Result<()> { for y in frame.bbox().y_range().rev() { for x in frame.bbox().x_range() { let pixel = frame.pixels[p2d(x, y)]; - let white = match pixel { - Pixel::Background => WHITE_VALUE, - Pixel::Foreground => 0, + let color = match pixel { + Pixel::Background => Color::black(), + Pixel::Foreground => Color::new(0xcc, 0x99, 0), }; - let rgbw: &[u8] = &[0, 0, 0, white]; - w.write_all(rgbw)?; + w.write_all(&color.rgb())?; } } Ok(w.flush()?)