User:Wrugtrab/Spectrun color sRGB.js

function SpectrumRGB(x) {

function redSpect(x) {

return ( ( ( ( ( ( Math.cos( Math.pow( 2, x ) ) / 5 ) + 1 ) / 2 ) * ( ( Math.tanh( x - 3 ) + 1 ) / 2) ) * ( 1 / ( Math.cosh( Math.pow( ( x - 2 ), 2 ) ) ) ) ) + ( 1 / ( Math.cosh( Math.pow( ( x + 2 ), 2 ) ) ) ) ) * 255

};

function greenSpect(x) {

return ( 1 / ( Math.cosh( Math.pow( x, 2 ) ) ) ) * 255

};

function blueSpect(x) {

return ( 1 / ( Math.cosh( Math.pow( ( x - 2 ), 2 ) ) ) ) * 255

};

return `rgb(${redSpect(-x)}, ${greenSpect(-x)}, ${blueSpect(-x)})`

};