Module:ColoredBits: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 22: | Line 22: | ||
result='white' | result='white' | ||
end | end | ||
return "<span style=\"color: " .. | return "<span style=\"color: " .. result .. ";\">" .. bit .. "</span>" | ||
end) | end) | ||
return a | return a |
Revision as of 19:45, 27 August 2019
local p = {}
function p.parse(frame)
local a = string.gsub(frame.args[1],"(%w)", 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