Module:Sandbox/ChaoticShadow/InfoboxBuilder: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 110: | Line 110: | ||
self:setHeaderTextColor(arg.text) |
self:setHeaderTextColor(arg.text) |
||
self:setHeaderBackgroundColor(arg.bg) |
self:setHeaderBackgroundColor(arg.bg) |
||
return self |
|||
end |
|||
--- Sets both the text and background color of the header |
|||
-- @param param string |
|||
-- Parameter name that helps map the colors |
|||
-- @param color_table { text, bg } |
|||
-- text string |
|||
-- Same as setHeaderTextColor |
|||
-- bg string |
|||
-- Same as setHeaderBackgroundColor |
|||
-- @return self |
|||
-- The current object |
|||
function InfoboxBuilder:setHeaderColorsByParam(param, color_table) |
|||
if param == nil then |
|||
error("Parameter name must not be nil") |
|||
elseif color_table == nil then |
|||
error("Header color table must not be nil") |
|||
end |
|||
local param_content = self:getContent(param) |
|||
local colors = color_table[param_content] |
|||
if colors == nil then |
|||
return self |
|||
end |
|||
self:setHeaderTextColor(colors.text) |
|||
self:setHeaderBackgroundColor(colors.bg) |
|||
return self |
return self |