Module:Rainbow text
Jump to navigation
Jump to search
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame)
local text = args[1] or args.text or 'Example text'
local mode = args.mode or ''
local styles = args.style or args.styles or ''
local customClass = args.class or ''
local backgroundClip = 'background-clip:text; '
local modeClass = 'rainbow-text'
if mode == 'background' then
backgroundClip = ''
modeClass = 'rainbow-background'
end
local classes = { 'rainbow-container', modeClass, customClass }
local out = {}
table.insert(out, frame:extensionTag{ name = 'TemplateStyles', args = { src = 'Rainbow text/styles.css' }})
table.insert(out, '<span class="' .. table.concat(classes, ' ') .. '" style="' .. backgroundClip .. styles .. '">' .. text .. '</span>')
return table.concat(out)
end
return p