Module:Character Colors: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (33 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
local colors = { | local colors = { | ||
AEMIL = { | AEMIL = { | ||
eyes = { | 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 = { | |||
horns = { "#F6585B" }, | |||
eyes = { "#FF966D" }, | |||
body = { "#F8B765" } | |||
}, | |||
JERGH = { | |||
horns = { "#9CD66C", "#FE5FCE" }, | |||
eyes = { "red" }, | |||
body = { "#F2F2F2" } | |||
}, | |||
KARUS = { | |||
body = { "red" } | |||
}, | |||
KHYEL = { | |||
body = { "teal" } | |||
}, | |||
KIRII = { | |||
horns = { "#C7C8C8" }, | |||
eyes = { "#9DB1EA" }, | |||
body = { "#5ED7D4" } | |||
}, | |||
KRYTA = { | |||
body = { "teal" } | |||
}, | |||
LLEMA = { | |||
horns = { "#1C3443" }, | |||
eyes = { "#EF8358" }, | |||
body = { "#4EAE8B" } | |||
}, | |||
LOTUS = { | |||
horns = { "#F49F50" }, | |||
eyes = { "#E25636" }, | |||
body = { "#EA0042" } | |||
}, | |||
LOXXE = { | |||
horns = { "#222C62" }, | |||
eyes = { "#C6C6C6" }, | |||
body = { "#303E89" } | |||
}, | |||
MALDA = { | |||
eyes = { "#D44A44" }, | |||
body = { "#EED07B" } | |||
}, | |||
MEAZS = { | |||
horns = { "#ED93D5" }, | |||
eyes = { "#D959F0" }, | |||
body = { "#F08E3C" } | |||
}, | |||
METIS = { | |||
horns = { "#742A7D" }, | |||
eyes = { "#D94837" }, | |||
body = { "#50C169" } | |||
}, | |||
ROMAL = { | |||
horns = { "#A09193" }, | |||
eyes = { "#6E7CD4" }, | |||
body = { "#381942" } | |||
}, | |||
RUTHA = { | |||
body = { "lime" } | |||
}, | |||
SELTE = { | |||
horns = { "#3B1B3C" }, | |||
eyes = { "#FE7A76" }, | |||
body = { "#F1B1DD" } | |||
}, | |||
SILLH = { | |||
horns = { "#F5877D" }, | |||
eyes = { "#FF6B1C" }, | |||
body = { "#F2D7BC" } | |||
}, | |||
TIMUR = { | |||
body = { "red" } | |||
}, | |||
VAEJA = { | |||
body = { "aqua-lime" }, | |||
eye = { "lavendar" } | |||
}, | |||
VESES = { | |||
body = { "pink" } | |||
}, | |||
VETTE = { | |||
horns = { "#7B7D89" }, | |||
eyes = { "#798ADB" }, | |||
body = { "#AAB0CF" } | |||
}, | |||
ZEHAL = { | |||
horns = { "#724731" }, | |||
eyes = { "#F3A799" }, | |||
body = { "#EAB275" } | |||
}, | |||
KRAZA = { | |||
horns = { "#FF6365" }, | |||
eyes = { "#E6E6E6" }, | |||
body = { "#593C2B" } | |||
}, | |||
ZSUNG = { | |||
horns = { "#340C0F" }, | |||
eyes = { "#AF0B19" }, | |||
body = { "#591217" } | |||
}, | |||
GIMEL = { | |||
horns = { "#80BFEB", "#F9C4FF", "#FFDEC4" }, | |||
eyes = { "#37ABFC", "#ED44FF", "#FFA154" }, | |||
body = { "#C4E7FF", "#F9C4FF", "#FFDEC4" } | |||
}, | |||
DEJIL = { | |||
horns = { "#D1BFA9" }, | |||
body = { "#FAF4E6" } | |||
} | } | ||
} | } | ||
| Line 14: | Line 142: | ||
local append_color_blocks = function(colors, color_type) | 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 | for i, color in pairs(colors[color_type]) do | ||
local is_hex_code = string.find(color, "#") ~= nil | local is_hex_code = string.find(color, "#") ~= nil | ||
if (is_hex_code) then | if (is_hex_code) then | ||
local red = tonumber(string.sub(color, 2, 3), 16) | |||
local green = tonumber(string.sub(color, 4, 5), 16) | |||
local blue = tonumber(string.sub(color, 6, 7), 16) | |||
local text_color = (red + green + blue > 560) and "black" or "white" | |||
result[#result + 1] = '<div style="background-color: ' .. color .. '"><strong><div style="color: ' .. text_color .. '; border: 1px solid gray; padding: 4px 10px;">' .. color .. '</div></strong></div>' | |||
else | else | ||
result[#result + 1] = '<div><strong><div style="border: 2px solid ' .. color .. '; padding: 4px 10px;">' .. color .. '</div></strong></div>' | result[#result + 1] = '<div><strong><div style="border: 2px solid ' .. color .. '; padding: 4px 10px;">' .. color .. '</div></strong></div>' | ||
| Line 24: | Line 163: | ||
end | end | ||
result[#result + 1] = ' | result[#result + 1] = '<table class="wikitable" style="width: 100%; margin: 0;">' | ||
result[#result + 1] = ' | |||
result[#result + 1] = ' | result[#result + 1] = '<tr>' | ||
result[#result + 1] = '<div style="display: flex; flex-flow | result[#result + 1] = '<th scope="col" style="width: 50px">Eyes</th>' | ||
result[#result + 1] = '<td><div style="display: flex; flex-flow: column">' | |||
append_color_blocks(colors[character], "eyes") | append_color_blocks(colors[character], "eyes") | ||
result[#result + 1] = '</div>' | result[#result + 1] = '</div></td>' | ||
result[#result + 1] = ' | result[#result + 1] = '<tr>' | ||
result[#result + 1] = ' | result[#result + 1] = '<th scope="col" style="width: 50px">Horns</th>' | ||
result[#result + 1] = '<div style="display: flex; flex-flow | result[#result + 1] = '<td><div style="display: flex; flex-flow: column">' | ||
append_color_blocks(colors[character], "horns") | append_color_blocks(colors[character], "horns") | ||
result[#result + 1] = '</div>' | result[#result + 1] = '</div></td>' | ||
result[#result + 1] = ' | result[#result + 1] = '<tr>' | ||
result[#result + 1] = ' | result[#result + 1] = '<th scope="col" style="width: 50px">Body</th>' | ||
result[#result + 1] = '<div style="display: flex; flex-flow | result[#result + 1] = '<td><div style="display: flex; flex-flow: column">' | ||
append_color_blocks(colors[character], "body") | append_color_blocks(colors[character], "body") | ||
result[#result + 1] = '</div>' | result[#result + 1] = '</div></td>' | ||
result[#result + 1] = '</table>' | |||
return table.concat(result, "\n") | return table.concat(result, "\n") | ||
Latest revision as of 21:39, 14 December 2023
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 = {
horns = { "#F6585B" },
eyes = { "#FF966D" },
body = { "#F8B765" }
},
JERGH = {
horns = { "#9CD66C", "#FE5FCE" },
eyes = { "red" },
body = { "#F2F2F2" }
},
KARUS = {
body = { "red" }
},
KHYEL = {
body = { "teal" }
},
KIRII = {
horns = { "#C7C8C8" },
eyes = { "#9DB1EA" },
body = { "#5ED7D4" }
},
KRYTA = {
body = { "teal" }
},
LLEMA = {
horns = { "#1C3443" },
eyes = { "#EF8358" },
body = { "#4EAE8B" }
},
LOTUS = {
horns = { "#F49F50" },
eyes = { "#E25636" },
body = { "#EA0042" }
},
LOXXE = {
horns = { "#222C62" },
eyes = { "#C6C6C6" },
body = { "#303E89" }
},
MALDA = {
eyes = { "#D44A44" },
body = { "#EED07B" }
},
MEAZS = {
horns = { "#ED93D5" },
eyes = { "#D959F0" },
body = { "#F08E3C" }
},
METIS = {
horns = { "#742A7D" },
eyes = { "#D94837" },
body = { "#50C169" }
},
ROMAL = {
horns = { "#A09193" },
eyes = { "#6E7CD4" },
body = { "#381942" }
},
RUTHA = {
body = { "lime" }
},
SELTE = {
horns = { "#3B1B3C" },
eyes = { "#FE7A76" },
body = { "#F1B1DD" }
},
SILLH = {
horns = { "#F5877D" },
eyes = { "#FF6B1C" },
body = { "#F2D7BC" }
},
TIMUR = {
body = { "red" }
},
VAEJA = {
body = { "aqua-lime" },
eye = { "lavendar" }
},
VESES = {
body = { "pink" }
},
VETTE = {
horns = { "#7B7D89" },
eyes = { "#798ADB" },
body = { "#AAB0CF" }
},
ZEHAL = {
horns = { "#724731" },
eyes = { "#F3A799" },
body = { "#EAB275" }
},
KRAZA = {
horns = { "#FF6365" },
eyes = { "#E6E6E6" },
body = { "#593C2B" }
},
ZSUNG = {
horns = { "#340C0F" },
eyes = { "#AF0B19" },
body = { "#591217" }
},
GIMEL = {
horns = { "#80BFEB", "#F9C4FF", "#FFDEC4" },
eyes = { "#37ABFC", "#ED44FF", "#FFA154" },
body = { "#C4E7FF", "#F9C4FF", "#FFDEC4" }
},
DEJIL = {
horns = { "#D1BFA9" },
body = { "#FAF4E6" }
}
}
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
local red = tonumber(string.sub(color, 2, 3), 16)
local green = tonumber(string.sub(color, 4, 5), 16)
local blue = tonumber(string.sub(color, 6, 7), 16)
local text_color = (red + green + blue > 560) and "black" or "white"
result[#result + 1] = '<div style="background-color: ' .. color .. '"><strong><div style="color: ' .. text_color .. '; 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] = '<table class="wikitable" style="width: 100%; margin: 0;">'
result[#result + 1] = '<tr>'
result[#result + 1] = '<th scope="col" style="width: 50px">Eyes</th>'
result[#result + 1] = '<td><div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "eyes")
result[#result + 1] = '</div></td>'
result[#result + 1] = '<tr>'
result[#result + 1] = '<th scope="col" style="width: 50px">Horns</th>'
result[#result + 1] = '<td><div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "horns")
result[#result + 1] = '</div></td>'
result[#result + 1] = '<tr>'
result[#result + 1] = '<th scope="col" style="width: 50px">Body</th>'
result[#result + 1] = '<td><div style="display: flex; flex-flow: column">'
append_color_blocks(colors[character], "body")
result[#result + 1] = '</div></td>'
result[#result + 1] = '</table>'
return table.concat(result, "\n")
end
return p