Module:Color contrast: Difference between revisions
Content deleted Content added
No edit summary |
refactor |
||
Line 16:
end
return v
end
local function rgbdec2lum( R, G, B )
end
Line 25 ⟶ 29:
local m = l - c/2
local
if( 0 <= h and h < 60 ) then
elseif( 60 <= h and h < 120 ) then
elseif( 120 <= h and h < 180 ) then
elseif( 180 <= h and h < 240 ) then
elseif( 240 <= h and h < 300 ) then
elseif( 300 <= h and h < 360 ) then
end
lum = rgbdec2lum(255*r, 255*g, 255*b)
▲ lum = 0.2126 * sRGB(R) + 0.7152 * sRGB(G) + 0.0722 * sRGB(B)
end
return lum
Line 81 ⟶ 85:
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R =
local G =
local B =
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R =
local G =
local B =
return rgbdec2lum(R, G, B)
end
|