Changes

Jump to navigation Jump to search
synced changes from sandbox - created an access point to lum available to other modules
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB ( v )
if (v <= 0.03928) then
v = v / 12.92
end
local function rgbdec2lum( R, G, B )
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
end
local function hsl2lum( h, s, l )
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
end
-- This exports the function for use in other modules.-- The colour is passed as a string.function p._lum(color) return color2lum(color)end local function color2lum( c )
if (c == nil) then
end
--[[
Use {{#invoke:Color contrast|somecolor}} directly or
{{#invoke:Color contrast}} from a wrapper template.
 
Parameters:
-- |1= — required; A color to check.
--]]
function p.lum(frame)
return color2lum(local color = frame.args[1] or frame:getParent().args[1] return p._lum(color)
end
Anonymous user

Navigation menu