Module:Color contrast:修订间差异
删除的内容 添加的内容
enwiki>Axolitl Implement edit request, for real this time 标签:已被回退 |
CaelLab-import(留言 | 贡献) huifu bei enwiki daoru dingti de banben (shangyiban zhwiki>Xiplus-abot) 标签:手工回退 |
||
第1行:
--
-- This module implements
--
--
--
--
--
local p = {}
第82行:
end
-- convert from hsl
if mw.ustring.match(c,'^
local h, s, l = mw.ustring.match(c,'^
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^
local R, G, B = mw.ustring.match(c,'^
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb
if mw.ustring.match(c,'^
local R, G, B = mw.ustring.match(c,'^
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
第105行:
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
第111行:
return rgbdec2lum(R, G, B)
elseif ( #cs == 3
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
第133行:
local css = (args['css'] and args['css'] ~= '') and true or false
local v1 = color2lum(args[1] or '')
local c2 = args[2] or '
local v2 = color2lum(c2)
local c3 = args[3] or '
local v3 = color2lum(c3)
local ratio1 = -1;
第150行:
if css then
local c1 = args[1] or ''
if
c1 = '#' .. c1
end
if
c2 = '#' .. c2
end
if
c3 = '#' .. c3
end
第184行:
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
第198行 ⟶ 第199行:
for k = 1,#slist do
local s = slist[k]
local
if (
local lum = color2lum(
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (
local lum = color2lum(
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
第221行 ⟶ 第222行:
Parameters:
-- |1=
--]]
function p.lum(frame)
| |||