69 lines
1007 B
Lua
69 lines
1007 B
Lua
-- enum helper
|
|
function Enum(tbl)
|
|
for i = 1, #tbl do
|
|
local v = tbl[i]
|
|
tbl[v] = i
|
|
end
|
|
return tbl
|
|
end
|
|
|
|
-- doesnt work
|
|
function GetTerminalSize()
|
|
io.write("\027[s")
|
|
io.write("\027[9999;B")
|
|
io.write("\027[9999;C")
|
|
--io.write("\027[6n")
|
|
io.write("\027[u")
|
|
end
|
|
|
|
COLORMODE = Enum {
|
|
"Normal",
|
|
"Bold",
|
|
"Dim",
|
|
"Italic",
|
|
"Underline",
|
|
"BlinkSlow",
|
|
"BlinkFast",
|
|
"Invert",
|
|
"Conceal",
|
|
"CrossedOut"
|
|
}
|
|
|
|
COLOR = Enum {
|
|
"Black",
|
|
"Red",
|
|
"Green",
|
|
"Yellow",
|
|
"Blue",
|
|
"Purple",
|
|
"Cyan",
|
|
"LightGray",
|
|
"Gray",
|
|
"HighRed",
|
|
"HighGreen",
|
|
"HighYellow",
|
|
"HighBlue",
|
|
"HighPurple",
|
|
"HighCyan",
|
|
"White"
|
|
}
|
|
|
|
function Colorize(Text,Color,Background,Colormode)
|
|
|
|
if Colormode then
|
|
lColormode = "\027["..tostring(Colormode-1).."m"
|
|
else
|
|
lColormode = ""
|
|
end
|
|
|
|
if Background then
|
|
lBackground = "\027[48;5;"..tostring(Background-1).."m"
|
|
else
|
|
lBackground = ""
|
|
end
|
|
|
|
lColoredText = "\027[38;5;"..tostring(Color-1).."m"..Text
|
|
|
|
return lColormode..lBackground..lColoredText.."\027[0;m"
|
|
end
|