Anonymous

Module:Color: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
m
support any valid HTML color on talk pages and such
(Add E to list of colors)
m (support any valid HTML color on talk pages and such)
Line 21: Line 21:
function p.color(colorId, text)
function p.color(colorId, text)
local colorData = data.colors[colorId]
local colorData = data.colors[colorId]
-- Backwards compatibility for inputting hex codes directly
-- Backwards compatibility for inputting any valid HTML color
-- We shouldn't allow this in articles anymore but we can keep support on user and talk pages to avoid breaking user signatures
-- In articles we should only allow defined game colors, but we can keep support for any HTML color on user and talk pages to avoid breaking user signatures that use the template this way
if colorData == nil and utilsString.startsWith(colorId, "#") and (mw.title.getCurrentTitle().isTalkPage or mw.title.getCurrentTitle().nsText == "User") then
if colorData == nil and (mw.title.getCurrentTitle().isTalkPage or mw.title.getCurrentTitle().nsText == "User") then
html = mw.html.create("span")
html = mw.html.create("span")
:css("color", colorId)
:css("color", colorId)