Content deleted Content added
No edit summary |
No edit summary |
||
Line 5:
local bluevalue = 0
local function nm2RGB(wavelength
-- code based on an algorithm from Dan Bruton's Color Science Page: http://www.physics.sfasu.edu/astro/color/spectra.html
-- calculating RGB color components
Line 34:
end
-- calculating intensity correction factor
local intensityfactor = 0
if (wavelength >= 380) and (wavelength < 420) then
Line 46 ⟶ 45:
greenvalue = greenvalue * intensityfactor
bluevalue = bluevalue * intensityfactor
end
Line 52 ⟶ 50:
-- this function returns the string "#RRGGBB" with approximate RGB value for a wavelength passed as a first argument
local wavelength = tonumber(frame.args[1])
nm2RGB(wavelength
local result='#' .. string.format("%.2X%.2X%.2X", 255*redvalue, 255*greenvalue, 255*bluevalue)
return result
Line 70 ⟶ 68:
local numofitems = 400
for wlcycle = 380,780,1 do
nm2RGB(wlcycle
if wlcycle < wavelength then
intensityfactor = (wlcycle - 380) / (wavelength - 380)
else
-- intensityfactor = (wlcycle - wavelength) / (380 - wavelength) + 1
intensityfactor = 0
end
if intensityfactor < 0 then
|