Module:Notice: Difference between revisions
m 1 revision imported: PS to FS migration |
No edit summary |
||
Line 16: | Line 16: | ||
return result[color] or color | return result[color] or color | ||
end | end | ||
function p.getStyleForColorBack(colorBack) | |||
result = { | |||
["green"] = "rgba(170, 220, 0, 0.2)", | |||
["teal"] = "rgba(47, 172, 172, 0.2)", | |||
["blue"] = "rgba(0, 153, 255, 0.2)", | |||
["orange"] = "rgba(255, 128, 0, 0.2)", | |||
["yellow"] = "rgba(235, 238, 61, 0.2)", | |||
["red"] = "rgba(217, 0, 0, 0.2)", | |||
["pink"] = "rgba(240, 60, 120, 0.2)", | |||
["maroon"] = "rgba(174, 21, 102, 0.2)", | |||
["gray"] = "rgba(201, 201, 201, 0.2)", | |||
} | |||
return result[colorBack] or colorBack | |||
end | |||
-- Entry point for the module | -- Entry point for the module | ||
Line 21: | Line 37: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local color = args.color or 'green' | local color = args.color or 'green' | ||
local colorBack = args.colorBack or '' | |||
local align = args.align or '' | local align = args.align or '' | ||
local textAlign = args['text-align'] or 'left' | local textAlign = args['text-align'] or 'left' | ||
Line 42: | Line 59: | ||
:css('margin', ".5em 0") | :css('margin', ".5em 0") | ||
:css('padding', ".5em") | :css('padding', ".5em") | ||
if colorBack ~= '' then | |||
root:css('background-color', p.getStyleForColorBack(colorBack)) | |||
end | |||
Line 47: | Line 68: | ||
root:css('width', width) | root:css('width', width) | ||
end | end | ||
if file ~= '' then | if file ~= '' then | ||
Line 52: | Line 74: | ||
:addClass('notice-image') | :addClass('notice-image') | ||
:css('position', "relative") | :css('position', "relative") | ||
:css('top', "50%") | --:css('top', "50%") | ||
:css("margin", "auto") | |||
:wikitext(string.format('[[File:%s|%s|link=]]', file, fileSize)) | :wikitext(string.format('[[File:%s|%s|link=]]', file, fileSize)) | ||
end | end |