1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-04 16:06:16 +00:00
opus/sys/apis/ansi.lua

56 lines
929 B
Lua
Raw Normal View History

2017-10-03 04:50:54 +00:00
local Ansi = setmetatable({ }, {
2018-01-24 22:39:38 +00:00
__call = function(_, ...)
local str = '\027['
for k,v in ipairs({ ...}) do
if k == 1 then
str = str .. v
else
str = str .. ';' .. v
end
end
return str .. 'm'
end
2017-10-03 04:50:54 +00:00
})
Ansi.codes = {
2018-01-24 22:39:38 +00:00
reset = 0,
white = 1,
orange = 2,
magenta = 3,
lightBlue = 4,
yellow = 5,
lime = 6,
pink = 7,
gray = 8,
lightGray = 9,
cyan = 10,
purple = 11,
blue = 12,
brown = 13,
green = 14,
red = 15,
black = 16,
onwhite = 21,
onorange = 22,
onmagenta = 23,
onlightBlue = 24,
onyellow = 25,
onlime = 26,
onpink = 27,
ongray = 28,
onlightGray = 29,
oncyan = 30,
onpurple = 31,
onblue = 32,
onbrown = 33,
ongreen = 34,
onred = 35,
onblack = 36,
2017-10-03 04:50:54 +00:00
}
for k,v in pairs(Ansi.codes) do
2018-01-24 22:39:38 +00:00
Ansi[k] = Ansi(v)
2017-10-03 04:50:54 +00:00
end
return Ansi