Content deleted Content added
No edit summary |
No edit summary |
||
Line 60:
-- The following formula is used for the complimentary color: {0xFF - RR, 0xFF - (RR + BB)/2, 0xFF - BB}
local wavelength = tonumber(frame.args[1])
nm2RGB(wavelength
-- local result='#' .. string.format("%.2X%.2X%.2X", 255*(1-redvalue), 255*(1-greenvalue), 255*(1-bluevalue))
-- local result='#' .. string.format("%.2X%.2X%.2X", 255*(1-redvalue), 255*(1-(redvalue+bluevalue)/2), 255*(1-bluevalue))
-- RGB to CMYK conversion
local cyanvalue = 1 - redvalue
local magentavalue = 1 - greenvalue
local yellowvalue = 1 - bluevalue
local keyvalue = math.min(cyanvalue, magentavalue, yellowvalue)
if keyvalue > 0 then
cyanvalue = cyanvalue - keyvalue
magentavalue = magentavalue - keyvalue
yellowvalue = yellowvalue - keyvalue
end
-- CMY complimentary color and back to RGB
redvalue = cyanvalue
greenvalue = magentavalue
bluevalue = yellowvalue
local result='#' .. string.format("%.2X%.2X%.2X", 255*redvalue, 255*greenvalue, 255*bluevalue)
return result
end
|