Изменения

функция для автоматического вычисления плохого контраста для чёрной иконки
Строка 41: Строка 41:  
local listclass
 
local listclass
 
local imageclass
 
local imageclass
   
local listnums = {}
 
local listnums = {}
   Строка 87: Строка 86:  
         -- to balance out the width of the navbar.
 
         -- to balance out the width of the navbar.
 
         if args.state == 'plain' then spacerSide = 'right' end
 
         if args.state == 'plain' then spacerSide = 'right' end
 +
       
 +
        -- Check colour contrast of the magnifying glass icon
 +
    local styleratio = require('Module:Color contrast')._styleratio
 +
    local glassColour = ''
 +
    local glassStyle = (titlestyle .. '; color:#666;' or '')
 +
    if styleratio{glassStyle} < 4.5 then
 +
    glassColour = ' white'
 +
    end
 
          
 
          
 
--- Мagnifying glass creation
 
--- Мagnifying glass creation
Строка 96: Строка 103:  
         :css('width', '5em')
 
         :css('width', '5em')
 
         :css('margin-right', '0.5em')
 
         :css('margin-right', '0.5em')
         :wikitext('[[Файл:Wikipedia interwiki section gear icon' .. (navbar and ({['white'] = 1, ['#ffffff'] = 1, ['#fff'] = 1})[string.lower( navbar )] and ' white' or '') .. '.svg|14px|Просмотр этого шаблона|link=Шаблон:' .. name .. '|alt=⛭]]')
+
         :wikitext('[[Файл:Wikipedia interwiki section gear icon' .. glassColour .. '.svg|14px|Просмотр этого шаблона|link=Шаблон:' .. name .. '|alt=⛭]]')
 
     end
 
     end
  
Анонимный участник