Jump to content

Module:Color contrast: Difference between revisions

add shorthand
m>Frietjes
No edit summary
m>Frietjes
(add shorthand)
Line 106: Line 106:
local G = sRGB( (16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4]))/255 )
local G = sRGB( (16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4]))/255 )
local B = sRGB( (16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6]))/255 )
local B = sRGB( (16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6]))/255 )
L = 0.2126 * R + 0.7152 * G + 0.0722 * B
return L
elseif ( #cs == 3 ) then
local R = sRGB( (16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1]))/255 )
local G = sRGB( (16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2]))/255 )
local B = sRGB( (16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3]))/255 )
L = 0.2126 * R + 0.7152 * G + 0.0722 * B
L = 0.2126 * R + 0.7152 * G + 0.0722 * B
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.