From ba6e23ee991c902052a18fb6a7de443ea40378fd Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Tue, 5 Mar 2024 23:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0tty=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E7=9A=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/kernel/tty.h | 18 ++++++++++++++---- src/kernel/tty/tty.rs | 7 ++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/kernel/tty.h b/include/kernel/tty.h index 2a1e6c3..6edf00d 100644 --- a/include/kernel/tty.h +++ b/include/kernel/tty.h @@ -99,8 +99,8 @@ tty **tty_get(usize id); /** * @brief 获取tty的id - * - * @return usize + * + * @return usize */ usize tty_get_id(tty *__tty); @@ -121,6 +121,16 @@ void tty_set_framebuffer(tty *ttyx, framebuffer *fb); void tty_text_print(tty *ttyx, char *string, u32 color, u32 bgcolor); #define gen_color(r, g, b) (((r) << 16) | ((g) << 8) | (b)) +#define WHITE gen_color(0xee, 0xee, 0xee) +#define BLACK gen_color(0, 0, 0) +#define RED gen_color(0xee, 0x22, 0x22) +#define GREEN gen_color(0x22, 0xee, 0x22) +#define BLUE gen_color(0x22, 0x22, 0xee) +#define YELLOW gen_color(0xee, 0xee, 0x22) +#define ORANGE gen_color(0xee, 0xaa, 0x22) +#define PURPLE gen_color(0xee, 0, 0xee) +#define PINK gen_color(0xee, 0x44, 0x66) +#define GRAY gen_color(0xaa, 0xaa, 0xaa) usize tty_get_width(tty *ttyx); usize tty_get_height(tty *ttyx); @@ -132,8 +142,8 @@ bool tty_is_enabled(tty *ttyx); /** * @brief 打开某个tty - * - * @param ttyx + * + * @param ttyx * @return true 打开成功 * @return false 已经打开 * 或作为raw_framebuffer类型的tty,framebuffer已被其它raw_framebuffer diff --git a/src/kernel/tty/tty.rs b/src/kernel/tty/tty.rs index f817e51..3fe729e 100644 --- a/src/kernel/tty/tty.rs +++ b/src/kernel/tty/tty.rs @@ -150,10 +150,11 @@ impl Color { pub const RED: Color = Color(0xee, 0x22, 0x22); pub const GREEN: Color = Color(0x22, 0xee, 0x22); pub const BLUE: Color = Color(0x22, 0x22, 0xee); - pub const YELLOW: Color = Color(0xee, 0x22, 0x22); - pub const ORANGE: Color = Color(0xee, 0xee, 0x22); - pub const PURPLE: Color = Color(0xee, 0, 0xee); + pub const YELLOW: Color = Color(0xee, 0xee, 0x22); + pub const ORANGE: Color = Color(0xee, 0xaa, 0x22); + pub const PURPLE: Color = Color(0xee, 0x22, 0xee); pub const PINK: Color = Color(0xee, 0x44, 0x66); + pub const GRAY: Color = Color(0xaa, 0xaa, 0xaa); } impl From for u32 {