Module:Utilities: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m get_slot_color now utilizes color formats, hex, rgb, hsl, cmyk
Sur (talk | contribs)
m get_slot_color debug_mode param added
Line 122: Line 122:
}
}
}
}
function p.get_slot_color(slot, color_format)
function p.get_slot_color(slot, color_format, debug_mode)
if type(slot) == 'table' and slot.args then
if type(slot) == 'table' and slot.args then
frame = slot
frame = slot
slot = frame.args[1]
slot = frame.args[1]
debug_mode = frame.args["debug_mode"]
end
end
Line 141: Line 142:
end
end
--Retrieve the color
local color = slot_data[color_format]
local color = slot_data[color_format]
if color == nil then
if color == nil then
Line 146: Line 148:
end
end
-- Return result
if debug_mode == nil then
debug_mode = false
end
if debug_mode then
return " " .. color
end
return color
return color
end
end


return p
return p