Module:Userbox: Difference between revisions

531 bytes removed ,  5 years ago
no edit summary
m (1 revision imported: Importing Committed identity template)
No edit summary
Line 297:
end
 
local legible = true
local contrast = require('Module:Color contrast')._ratio
 
Line 310 ⟶ 309:
wikitext = wikitext:gsub("%[%[%s*[Ff][Ii][Ll][Ee]%s*:[^|]-(|.-)]]", get_alt)
return mw.text.trim(wikitext) ~= ""
end
 
if contrast { data.infoColor, data.backgroundColor, error = 0 } < 4.5 then
legible = false
end
 
if data.showId and contrast { data.idColor, data.idBackgroundColor, error = 0 } < 4.5 then
if has_text(data.id or "") then
legible = false
end
end
 
if data.showId2 and contrast { data.id2Color, data.id2BackgroundColor, error = 0 } < 4.5 then
if has_text(data.id2 or "") then
legible = false
end
end
 
if not legible then
root:wikitext('[[Category:Potentially illegible userboxes]]')
end
 
0

edits