Module:Character Colors: Difference between revisions
Jump to navigation
Jump to search
Created page with "local p = {} local colors = { AEMIL = { eyes = { } } } function p.get_table_for_character(frame) local character = frame.args[1] local result = {} local append_color_blocks = function(colors, color_type) 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..." |
No edit summary |
||
| Line 34: | Line 34: | ||
result[#result + 1] = '{-' | result[#result + 1] = '{-' | ||
result[#result + 1] = '! scope="col" style="width: 50px"; | Horns' | result[#result + 1] = '! scope="col" style="width: 50px"; | Horns' | ||
result[#result + 1] = '<div style="display: flex; flex-flow; col>' | |||
append_color_blocks(colors[character], " | append_color_blocks(colors[character], "horns") | ||
result[#result + 1] = '</div>' | result[#result + 1] = '</div>' | ||
result[#result + 1] = '{-' | result[#result + 1] = '{-' | ||
result[#result + 1] = '! scope="col" style="width: 50px"; | Body' | result[#result + 1] = '! scope="col" style="width: 50px"; | Body' | ||
result[#result + 1] = '<div style="display: flex; flex-flow; col>' | |||
append_color_blocks(colors[character], "horns") | |||
result[#result + 1] = '</div>' | |||
return table.concat(result, "\n") | return table.concat(result, "\n") | ||
Revision as of 20:07, 13 December 2023
Documentation for this module may be created at Module:Character Colors/doc
local p = {}
local colors = {
AEMIL = {
eyes = {
}
}
}
function p.get_table_for_character(frame)
local character = frame.args[1]
local result = {}
local append_color_blocks = function(colors, color_type)
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; col>'
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; col>'
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; col>'
append_color_blocks(colors[character], "horns")
result[#result + 1] = '</div>'
return table.concat(result, "\n")
end
return p