diff options
Diffstat (limited to 'src/user/highway/line.c')
-rw-r--r-- | src/user/highway/line.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/user/highway/line.c b/src/user/highway/line.c index cefdf92..5d1e543 100644 --- a/src/user/highway/line.c +++ b/src/user/highway/line.c @@ -17,12 +17,12 @@ static inline uint8_t hex_to_int(char ch) { } void ensure_color() { - const struct no_null_sn *fg = get_var((struct no_null_sn){.data = "_color_fg", .length = 9}); - const struct no_null_sn *bg = get_var((struct no_null_sn){.data = "_color_bg", .length = 9}); - if (fg && bg) + const struct no_null_sn *color = get_var((struct no_null_sn){.data = "_color", .length = 6}); + //fgbg + if (color) term_set_color( - (hex_to_int(fg->data[0]) << 4) | hex_to_int(fg->data[1]), - (hex_to_int(bg->data[0]) << 4) | hex_to_int(bg->data[1]) + (hex_to_int(color->data[0]) << 4) | hex_to_int(color->data[1]), + (hex_to_int(color->data[2]) << 4) | hex_to_int(color->data[3]) ); } @@ -100,13 +100,19 @@ void run_line(const char *original_line) { term_clear(); term_paint(); } + else if (blockequ(line, "color", 6)) { + new_color(); + ensure_color(); + term_paint(); + } else if (blockequ(line, "help", 5)) { term_add_sz("Highway is a command shell for Portland OS. It includes variable support and a couple of pseudo-commands. Variables are addressed by surrounding with \"$\". The following list shows each of the pseudo-commands.\n\n" " source FILE\t" "run each command in FILE\n" - " clear\t\t\t" "clear the screen\n" - " echo STRING\t" "print STRING\n" " set VAR VALUE\t" "set $VAR$ to VALUE\n" + " color\t\t\t" "new color scheme\n" + " clear\t\t\t" "clear the screen\n" " vars\t\t\t" "dump variables\n" + " echo STRING\t" "print STRING\n" " quit\t\t\t" "exit highway\n" " help\t\t\t" "show this\n"); term_paint(); |