Content deleted Content added
add color ratio problem check |
add links/visited links contrast check to demo |
||
Line 458:
:css("text-decoration-style", "dotted")
:wikitext("?")
)
:wikitext(")")
end
function inlineWarning(details)
return mw.html.create("span")
:css("color", "darkred")
:wikitext("(")
:node(
mw.html.create("span")
:attr("title", details)
:css("text-decoration", "underline")
:css("text-decoration-style", "dotted")
:wikitext("!")
)
:wikitext(")")
Line 500 ⟶ 514:
local catColorBlackRatio = colorRatio({ "#" .. cat["color"], "black" });
local catColorLinkRatio = colorRatio({ "#" .. cat["color"], "#0645ad" });
if catColorBlackRatio == "?" then▼
local catColorVisitedLinkRatio = colorRatio({ "#" .. cat["color"], "#0b0080" });
if catColorBlackRatio == "?" or catColorLinkRatio == "?" or catColorVisitedLinkRatio == "?" then
color
:wikitext(" ")
:node(inlineError("This color must be a hexadecimal color."))
else
color▼
color
:wikitext(" ") :node(inlineError("This color has contrast issues with black (not WCAG 2.0 AA-compatible)."))
end
if catColorLinkRatio < 4.5 then
▲ color
:wikitext(" ")
:node(inlineWarning("This color has contrast issues with links (not WCAG 2.0 AA-compatible)."))
end
if catColorVisitedLinkRatio < 4.5 then
color
:wikitext(" ")
:node(inlineWarning("This color has contrast issues with visited links (not WCAG 2.0 AA-compatible)."))
end
end
|