Module:Color: Difference between revisions

Jump to navigation Jump to search
527 bytes removed ,  16 September 2022
Removing support for arbitrary web colors - Template:Web Color can be used for that now. It's a completely different use case that should be handled by a separate template. This one should be for named in-game colors only.
(more documentation)
(Removing support for arbitrary web colors - Template:Web Color can be used for that now. It's a completely different use case that should be handled by a separate template. This one should be for named in-game colors only.)
Line 37: Line 37:
local colorData = data.colors[colorId]
local colorData = data.colors[colorId]
-- Backwards compatibility for inputting any valid HTML color
if colorData == nil then
-- 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 (mw.title.getCurrentTitle().isTalkPage or mw.title.getCurrentTitle().nsText == "User" or mw.title.getCurrentTitle().nsText == "Zelda_Wiki") then
html = mw.html.create("span")
:css("color", colorId)
:wikitext(text)
return tostring(html)
elseif colorData == nil then
utilsError.warn(string.format("<code>%s</code> is not a valid color name. See [[Template:Color]] for a list of supported colors.", colorId))
utilsError.warn(string.format("<code>%s</code> is not a valid color name. See [[Template:Color]] for a list of supported colors.", colorId))
return text, "[[Category:Articles Using Invalid Color Names]]"
return text, "[[Category:Articles Using Invalid Color Names]]"

Navigation menu