working on colour support

This commit is contained in:
2025-02-21 16:13:27 +00:00
parent 34b960c20a
commit e626a3bcf2
7 changed files with 145 additions and 71 deletions
+5 -3
View File
@@ -5,7 +5,7 @@ use lazy_static::lazy_static;
use spin::{Lazy, Mutex};
use x86_64::instructions::interrupts;
use lib_framebuffer::FRAMEBUFFER_WRITER;
use lib_framebuffer::{FRAMEBUFFER_WRITER, Color};
mod font;
use font::FONT;
@@ -15,6 +15,8 @@ static FONT_HEIGHT: u32 = 16;
pub static WRITER: Lazy<Mutex<Writer>> = Lazy::new(|| Mutex::new(Writer::new()));
pub fn screensize_chars() -> (u32, u32) {
let writer = WRITER.lock();
(writer.screen_width, writer.screen_height)
@@ -71,10 +73,10 @@ impl Writer {
if line & (0x80 >> col) != 0 {
// write the foreground color
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.fg_color);
writer.write_pixel(pixel_x as usize, pixel_y as usize, Color::RGB(255, 0, 0));
} else {
// write the background color
writer.write_pixel(pixel_x as usize, pixel_y as usize, self.bg_color);
writer.write_pixel(pixel_x as usize, pixel_y as usize, Color::HexARGB(self.bg_color));
}
}
}