feat: add components

This commit is contained in:
2025-04-04 17:19:07 +08:00
parent 6f494ec9ca
commit c37b9f0ab2
40 changed files with 2088 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
var HEADER = '\033[95m';
var OKBLUE = '\033[94m';
var OKGREEN = '\033[92m';
var WARNING = '\033[93m';
var FAIL = '\033[91m';
var BOLD = '\033[1m';
var UNDERLINE = '\033[4m';
var ENDC = '\033[0m';
var colorMapping = {
"header": HEADER,
"okblue": OKBLUE,
"okgreen": OKGREEN,
"warning": WARNING,
"fail": FAIL,
"bold": BOLD,
"underline": UNDERLINE,
"none": null // nothing special
};
var colorPrint = exports;
for (var k in colorMapping) {
colorPrint[k] = {};
colorPrint[k].render = ((k) => {
return (x) => {
return colorMapping[k] ? (colorMapping[k] + x + ENDC) : x;
};
})(k);
colorPrint[k].print = ((k) => {
return (x) => {
print(colorPrint[k].render(x));
};
})(k);
colorPrint[k].println = ((k) => {
return (x) => {
println(colorPrint[k].render(x));
};
})(k);
}