fix: color change is now working
This commit is contained in:
44
headers/color.h
Normal file
44
headers/color.h
Normal file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct color {
|
||||
char *name;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
#define BLACK 0x000000
|
||||
#define BLUE 0x0000FF
|
||||
#define GREEN 0x008000
|
||||
#define CYAN 0x00FFFF
|
||||
#define RED 0xFF0000
|
||||
#define MAGENTA 0xFF00FF
|
||||
#define BROWN 0xA52A2A
|
||||
#define LIGHT_GREY 0xD3D3D3
|
||||
#define DARK_GREY 0x555555
|
||||
#define LIGHT_BLUE 0xADD8E6
|
||||
#define LIGHT_GREEN 0x90EE90
|
||||
#define LIGHT_CYAN 0xE0FFFF
|
||||
#define LIGHT_RED 0xFF6666
|
||||
#define LIGHT_MAGENTA 0xFF77FF
|
||||
#define LIGHT_YELLOW 0xFFFF01
|
||||
#define WHITE 0xFFFFFF
|
||||
|
||||
static const struct color colors[] = {
|
||||
{"BLACK", BLACK},
|
||||
{"BLUE", BLUE},
|
||||
{"GREEN", GREEN},
|
||||
{"CYAN", CYAN},
|
||||
{"RED", RED},
|
||||
{"MAGENTA", MAGENTA},
|
||||
{"BROWN", BROWN},
|
||||
{"LIGHT_GREY", LIGHT_GREY},
|
||||
{"DARK_GREY", DARK_GREY},
|
||||
{"LIGHT_BLUE", LIGHT_BLUE},
|
||||
{"LIGHT_GREEN", LIGHT_GREEN},
|
||||
{"LIGHT_CYAN", LIGHT_CYAN},
|
||||
{"LIGHT_RED", LIGHT_RED},
|
||||
{"LIGHT_MAGENTA", LIGHT_MAGENTA},
|
||||
{"LIGHT_YELLOW", LIGHT_YELLOW},
|
||||
{"WHITE", WHITE},
|
||||
};
|
||||
@ -22,7 +22,6 @@ struct screen {
|
||||
uint32_t fg_color;
|
||||
uint32_t bg_color;
|
||||
uint8_t buffer[VGA_WIDTH * VGA_HEIGHT];
|
||||
uint32_t default_color;
|
||||
struct icon *background;
|
||||
struct font *font;
|
||||
char line[256];
|
||||
@ -52,6 +51,8 @@ enum cursor_direction { LEFT, RIGHT, UP, DOWN };
|
||||
void terminal_initialize(void);
|
||||
void terminal_set_bg_color(uint32_t color);
|
||||
void terminal_set_fg_color(uint32_t color);
|
||||
uint32_t terminal_get_fg_color(void);
|
||||
uint32_t terminal_get_bg_color(void);
|
||||
int terminal_putchar(char c);
|
||||
int terminal_write(const char *data, size_t size);
|
||||
int terminal_writestring(const char *data);
|
||||
@ -61,11 +62,7 @@ void terminal_clear(void);
|
||||
struct key_event terminal_getkey(void);
|
||||
void update_cursor(void);
|
||||
void move_cursor(int direction);
|
||||
void set_color_level(int level);
|
||||
void terminal_set_default_fg_color(uint32_t fg_color);
|
||||
void terminal_set_default_bg_color(uint32_t fg_color);
|
||||
void terminal_change_default_fg_color(uint32_t color);
|
||||
uint32_t terminal_get_default_color(void);
|
||||
uint8_t terminal_get_char(int column, int row);
|
||||
void terminal_remove_last_char(void);
|
||||
void terminal_refresh_color(void);
|
||||
// TODO void terminal_refresh_color(void);
|
||||
|
||||
Reference in New Issue
Block a user