Module:Character Colors
Documentation for this module may be created at Module:Character Colors/doc
local p = {}
local colors = {
AEMIL = {
horns = { '#E29A56' },
eyes = { '#E16A72' },
body = { '#56EB8E' }
},
DZUNE = {
horns = { '#E38663' },
eyes = { '#521616' },
body = { '#F06565' }
},
ELLAI = {
horns = { "#5D4426" },
eyes = { '#5D4426' },
body = { '#99D779', '#E1EAB2' }
},
EVJAR = {
horns = { "#220E32" },
eyes = { "#F79A60" },
body = { "#6C2717" }
},
HAGAZ = {
body = { "orange" }
},
JAELA = {
horn = { "#F6585B" },
eyes = { "#FF966D" },
body = { "#F8B765" }
},
JERGH = {
horn = { "#9CD66C", "#FE5FCE" },
eyes = { "red" },
body = { "#F2F2F2" }
}
}
function p.get_table_for_character(frame)
local character = frame.args[1]
local result = {}
local append_color_blocks = function(colors, color_type)
if (colors and colors[color_type]) == nil then
result[#result + 1] = '?'
return
end
for i, color in pairs(colors[color_type]) do
local is_hex_code = string.find(color, "#") ~= nil
if (is_hex_code) then
result[#result + 1] = '<div style="background-color: ' .. color .. '"><strong><div style="color: white; border: 1px solid gray; padding: 4px 10px;">' .. color .. '</div></strong></div>'
else
result[#result + 1] = '<div><strong><div style="border: 2px solid ' .. color .. '; padding: 4px 10px;">' .. color .. '</div></strong></div>'
end
end
end
result[#result + 1] = '{| class="wikitable" style="width: 100%; margin: 0;"'
result[#result + 1] = '|-'
result[#result + 1] = '! scope="col" style="width: 50px"; | Eyes'
result[#result + 1] = '| <div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "eyes")
result[#result + 1] = '</div>'
result[#result + 1] = '|-'
result[#result + 1] = '! scope="col" style="width: 50px"; | Horns'
result[#result + 1] = '| <div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "horns")
result[#result + 1] = '</div>'
result[#result + 1] = '|-'
result[#result + 1] = '! scope="col" style="width: 50px"; | Body'
result[#result + 1] = '| <div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "body")
result[#result + 1] = '</div>'
result[#result + 1] = '|}'
return table.concat(result, "\n")
end
return p