summaryrefslogtreecommitdiff
path: root/src/user/highway/line.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-02-16 22:26:47 -0500
committerBenji Dial <benji6283@gmail.com>2021-02-16 22:26:47 -0500
commitab4e1cfc8c587e4144d847bbd41307eff03130b2 (patch)
tree4e5502422977c747f3e65633ede26b73d9556ca1 /src/user/highway/line.c
parent2de07a2abea4081ebab6d80729e5665ba862c74c (diff)
downloadportland-os-ab4e1cfc8c587e4144d847bbd41307eff03130b2.tar.gz
rtc timestamp, knob rand, random terminal color
Diffstat (limited to 'src/user/highway/line.c')
-rw-r--r--src/user/highway/line.c20
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();