Module:Dièse couleur web
Révision datée du 23 août 2018 à 18:38 par Zebulon84 (discussion) (création d'une sous-fonction pour faciliter l'utilisation depuis un autre module)
local z = {}
function z.couleur(value)
if value:find('#') == 1 then
return '#' .. value:sub(2)
elseif mw.ustring.match(value, '^%x%x%x%x%x%x$') or mw.ustring.match(value, '^%x%x%x$') then
return '#' .. value
else
return value
end
end
function z.main(frame)
local value = mw.text.trim(frame.args[1]) return z.couleur(value)
end
return z