aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-27 16:56:34 +0100
committerKim Alvefur <zash@zash.se>2016-02-27 16:56:34 +0100
commit6ebfda549383872b983982f2ab472053195e27c5 (patch)
tree98010923671f8e53c3056b7659c91c96623036c7 /util
parent6fc40230c33b28576f30fa7681eeac33ac013edf (diff)
downloadprosody-6ebfda549383872b983982f2ab472053195e27c5.tar.gz
prosody-6ebfda549383872b983982f2ab472053195e27c5.zip
util.termcolours: Add some CSS color names
Diffstat (limited to 'util')
-rw-r--r--util/termcolours.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/termcolours.lua b/util/termcolours.lua
index 5d06fd35..a0fee7ce 100644
--- a/util/termcolours.lua
+++ b/util/termcolours.lua
@@ -80,6 +80,18 @@ setmetatable(stylemap, { __index = function(_, style)
return g .. color(hex2rgb(style));
end } );
+local csscolors = {
+ red = "ff0000"; fuchsia = "ff00ff"; green = "008000"; white = "ffffff";
+ lime = "00ff00"; yellow = "ffff00"; purple = "800080"; blue = "0000ff";
+ aqua = "00ffff"; olive = "808000"; black = "000000"; navy = "000080";
+ teal = "008080"; silver = "c0c0c0"; maroon = "800000"; gray = "808080";
+}
+for color, rgb in pairs(csscolors) do
+ stylemap[color] = stylemap[color] or stylemap[rgb];
+ color, rgb = color .. " background", rgb .. " background"
+ stylemap[color] = stylemap[color] or stylemap[rgb];
+end
+
local function getstyle(...)
local styles, result = { ... }, {};
for i, style in ipairs(styles) do