Add function to change writer color
This commit is contained in:
parent
32c22fe34a
commit
84eb9b1a72
|
@ -36,7 +36,9 @@ pub extern "C" fn _start() {
|
|||
#[cfg(test)]
|
||||
test_main();
|
||||
|
||||
crate::vga_buffer::change_color(crate::vga_buffer::Color::Yellow, crate::vga_buffer::Color::Black);
|
||||
println!("It did not crash!");
|
||||
crate::vga_buffer::change_color(crate::vga_buffer::Color::White, crate::vga_buffer::Color::Black);
|
||||
loop {
|
||||
x86_64::instructions::hlt();
|
||||
}
|
||||
|
|
|
@ -199,3 +199,9 @@ pub fn move_cursor(x: u16, y: u16) {
|
|||
let mut cursor = CURSOR.lock();
|
||||
cursor.move_cursor(pos);
|
||||
}
|
||||
|
||||
pub fn change_color(foreground: Color, background: Color) {
|
||||
let mut writer = WRITER.lock();
|
||||
let color = ColorCode::new(foreground, background);
|
||||
writer.color_code = color;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue