Module:ColoredBits
Jump to navigation
Jump to search
local p = {}
function p.parse(frame)
local a = string.gsub(frame.args[1],"([012345678ABCD])", function(bit)
local luatable = {
['0'] = "#98875f",
['1'] = "#a64a2e",
['A'] = "#d74200",
['2'] = "#009403",
['B'] = "#00c420",
['3'] = "#0048bd",
['C'] = "#0096ff",
['4'] = "#40a4b9",
['D'] = "#77bfcf",
['8'] = "#da5bd6",
['6'] = "#cfc041",
['5'] = "#155352",
['7'] = "#ffffff",
}
local result= luatable[bit]
if result == nil then
result='white'
end
return "<span style=\"color: " .. result .. ";\">" .. bit .. "</span>"
end)
return a
end
return p