Module:Navbox: Difference between revisions

Jump to navigation Jump to search
385 bytes added ,  7 September 2015
Sync and fix styleratio invocation
(Undid revision 679881839 by Alakzi (talk) - This change has more than just color tracking in it and is causing issues, see talk page)
(Sync and fix styleratio invocation)
Line 271: Line 271:
local function hasBackgroundColors()
local function hasBackgroundColors()
     return mw.ustring.match(args.titlestyle or '','background') or mw.ustring.match(args.groupstyle or '','background') or mw.ustring.match(args.basestyle or '','background')
     return mw.ustring.match(args.titlestyle or '','background') or mw.ustring.match(args.groupstyle or '','background') or mw.ustring.match(args.basestyle or '','background')
end
local function isIllegible()
    local styleratio = require('Module:Color contrast')._styleratio
    for key, style in pairs(args) do
        if key:match("style$") then
            if styleratio{style} < 4.5 then
                return true
            end
        end
    end
    return false
end
end


Line 277: Line 290:
     if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
     if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
     if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
     if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
    if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
     return cats
     return cats
end
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu