mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-10 05:01:50 +09:00
make colour change in terminal work on command.js; video will draw on centre of the app window
This commit is contained in:
18
assets/disk0/tvdos/bin/color.js
Normal file
18
assets/disk0/tvdos/bin/color.js
Normal file
@@ -0,0 +1,18 @@
|
||||
let backs = {0:[0,0,0],1:[3,2,15],2:[3,9,4],3:[6,13,15],4:[15,4,4],5:[15,6,15],6:[15,13,0],7:[14,14,14]}
|
||||
let fores = {0:240,1:49,2:61,3:114,4:211,5:219,6:230,7:254}
|
||||
|
||||
if (exec_args[1]) {
|
||||
let b = exec_args[1][0].toUpperCase()
|
||||
let f = exec_args[1][1].toUpperCase()
|
||||
|
||||
if (b == f) return 1
|
||||
let ba = backs[b]
|
||||
let fo = fores[f]
|
||||
|
||||
if (!ba || !fo) return 2
|
||||
|
||||
serial.println(fo)
|
||||
|
||||
graphics.setBackground(ba[0], ba[1], ba[2])
|
||||
con.color_pair(fo, 255)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ function print_prompt_text() {
|
||||
con.color_pair(253,255);
|
||||
}
|
||||
else {
|
||||
con.color_pair(253,255);
|
||||
// con.color_pair(253,255);
|
||||
if (errorlevel != 0)
|
||||
print(CURRENT_DRIVE + ":/" + shell_pwd.join("/") + " [" + errorlevel + "]" + PROMPT_TEXT);
|
||||
else
|
||||
@@ -490,13 +490,13 @@ else {
|
||||
|
||||
let cmdExit = false;
|
||||
if (goInteractive) {
|
||||
con.reset_graphics();
|
||||
con.curs_set(1);
|
||||
greet();
|
||||
|
||||
let cmdHistory = []; // zeroth element is the oldest
|
||||
let cmdHistoryScroll = 0; // 0 for outside-of-buffer, 1 for most recent
|
||||
while (!cmdExit) {
|
||||
con.reset_graphics();
|
||||
con.curs_set(1);
|
||||
print_prompt_text();
|
||||
|
||||
var cmdbuf = "";
|
||||
|
||||
Reference in New Issue
Block a user