mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Implemented Escape Sequences!!!!
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#define BLACK 0x00000000 // 0
|
||||
#define RED 0x00ff0000 // 1
|
||||
#define GREEN 0x0000ff00 // 2
|
||||
#define YELLOW 0x00ffff00 // 3
|
||||
#define BLUE 0x000000ff // 4
|
||||
#define MAGENTA 0x00ff00ff // 5
|
||||
#define CYAN 0x0000ffff // 6
|
||||
#define WHITE 0x00ffffff // 7
|
||||
|
||||
uint32_t codeToColor(uint8_t code) {
|
||||
switch (code) {
|
||||
case 0: return BLACK;
|
||||
case 1: return RED;
|
||||
case 2: return GREEN;
|
||||
case 3: return YELLOW;
|
||||
case 4: return BLUE;
|
||||
case 5: return MAGENTA;
|
||||
case 6: return CYAN;
|
||||
case 7: return WHITE;
|
||||
default: return BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,10 @@ void print(const char* s) {
|
||||
write(STDOUT, s, strlen(s));
|
||||
}
|
||||
|
||||
void clear() {
|
||||
print("\x1b[J");
|
||||
}
|
||||
|
||||
void putc(char c) {
|
||||
static char _c; // We need to pass in a static address. Idk why
|
||||
_c = c;
|
||||
|
||||
Reference in New Issue
Block a user