Radio-Sky Spectrograph Color File Generator
Dave Typinski, AJ4CO
August, 2010

Color File Generator

(* Define domain for low end fade up from black *)
lo1=0;
hi1=400*4;
width1=hi1-lo1; 

(* Define low end domain functions for red, green, blue *)
(*fnred1[x_]:=x*1/width1-0.75/;3 width1/4≤x≤width1;*)
(*fnred1[x_]:=0/;0≤x<3 width1/4;*)
fnred1[x_]:=0;
(*fngrn1[x_]:=x*1/width1-0.5/;width1/2≤x≤width1;*)
(*fngrn1[x_]:=0/;0≤x<width1/2;*)
fngrn1[x_]:=x*1/(2 width1);
(*fnblu1[x_]:=x*1/width1;*)
fnblu1[x_]:=(((1-(((((width1-x)/width1)))^2)))^(1/2));

(* Define a low end domain saturation function for reference use *)
fnsat1[x_]:=(fnred1[x]+fngrn1[x]+fnblu1[x])/3;

(* Plot low end domain red, green and blue functions along with saturation *)
Plot[{fnred1[x],fngrn1[x],fnblu1[x],fnsat1[x]},{x,0,width1},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width1" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors1=Table[{fnred1[i],fngrn1[i],fnblu1[i]},{i,lo1,hi1}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors1}],AspectRatio->.2]

(* Define domain for bulk of color scheme *)
lo2=400*4;
hi2=3795*4;
width2=hi2-lo2; 

(* Define squishing function; color changes rapidly at low end, slowly at high end *)
squishfactor=1.2; 
squish[x_]:=((((width2^squishfactor)-(((width2-x))^squishfactor)))^(1/squishfactor));
(* plot shishing function for reference *)
Plot[{x,squish[x],width2},{x,0,hi2},PlotStyle->{{RGBColor[0,0,0],Thin},{RGBColor[0,0,.9],Thin}},AspectRatio->1]


(* Define middle domain functions for red, green, blue *)
fnred2[x_]:=N[Abs[Sin[(squish[x-lo2]*5/6-width2/6) (π/width2)]]]/;(squish[x-lo2]*5/6-width2/6)≥0;
fnred2[x_]:=0/;(squish[x-lo2]*5/6-width2/6)<0;
fngrn2[x_]:=N[Abs[Sin[(squish[x-lo2]*5/6+width2/3-width2/6) (π/width2)]]];
fnblu2[x_]:=N[Abs[Sin[(squish[x-lo2]*5/6-width2/3-width2/6) (π/width2)]]];


(* Define a middle domain saturation function for reference use *)
fnsat2[x_]:=(fnred2[x]+fngrn2[x]+fnblu2[x])/3;

(* Plot middle domain red, green and blue functions along with saturation *)
Plot[{fnred2[x],fngrn2[x],fnblu2[x],fnsat2[x]},{x,lo2,hi2},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width2" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors2=Table[{fnred2[i],fngrn2[i],fnblu2[i]},{i,lo2,hi2}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors2}],AspectRatio->.2]

Print["Red(",lo2,") = ",fnred2[lo2],"     Red(",hi2,") = ",fnred2[hi2]]
Print["Grn(",lo2,") = ",fngrn2[lo2],"     Grn(",hi2,") = ",fngrn2[hi2]]
Print["Blu(",lo2,") = ",fnblu2[lo2],"     Blu(",hi2,") = ",fnblu2[hi2]]

(* Define domain for high end fade to white *)
lo3=3795*4;
hi3=4095*4+3;
width3=hi3-lo3; 

(* Define high end domain functions for red, green, blue *)
fnred3[x_]:=(x-lo3)*(1-0.866025)/width3+0.866025;
fngrn3[x_]:=(x-lo3)*1/width3;
fnblu3[x_]:=(x-lo3)*(1-0.866025)/width3+0.866025;

(* Define a high end domain saturation function for reference use *)
fnsat3[x_]:=(fnred3[x]+fngrn3[x]+fnblu3[x])/3;

(* Plot high end domain red, green and blue functions along with saturation *)
Plot[{fnred3[x],fngrn3[x],fnblu3[x],fnsat3[x]},{x,lo3,hi3},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width3" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors3=Table[{fnred3[i],fngrn3[i],fnblu3[i]},{i,lo3,hi3}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors3}],AspectRatio->.2]

(* Define domain of entire color scheme *)
lo=0;
hi=4095*4+3;
width=hi-lo; 

(* Define piecewise domain functions for red, green, blue *)
fnred[x_]:=fnred1[x]/;lo1≤x≤hi1;
fnred[x_]:=fnred2[x]/;lo2<x≤hi2;
fnred[x_]:=fnred3[x]/;lo3<x≤hi3;

fngrn[x_]:=fngrn1[x]/;lo1≤x≤hi1;
fngrn[x_]:=fngrn2[x]/;lo2<x≤hi2;
fngrn[x_]:=fngrn3[x]/;lo3<x≤hi3;

fnblu[x_]:=fnblu1[x]/;lo1≤x≤hi1;
fnblu[x_]:=fnblu2[x]/;lo2<x≤hi2;
fnblu[x_]:=fnblu3[x]/;lo3<x≤hi3;

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnred[x]+fngrn[x]+fnblu[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnred[x],fngrn[x],fnblu[x],fnsat[x]},{x,lo,hi},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnred[i],fngrn[i],fnblu[i]},{i,lo,hi}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]

(* Create Radio-Sky Spectrograph color definitions file *)
Colors;
ColorDefs=Table[65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],{i,lo,hi}];
Export["N:\\Documents\\0 RA\\Software\\Radio-Sky Spectrograph\\Color File Maker\\AJ4CO-Rainbow-14-bit(RSS).txt",ColorDefs]

(* Create Radio-Sky Spectrograph color definitions file *)

Colors;
ColorDefs=Table[{65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],Round[255*fnblu[i]],Round[255*fngrn[i]],Round[255*fnred[i]]},{i,lo,hi}];
Export["N:\\Documents\\0 RA\\Software\\Radio-Sky Spectrograph\\Color File Maker\\AJ4CO-Rainbow-14-bit-Alternate1.txt",ColorDefs]

Colors;
ColorDefs=Table[{65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],255*fnblu[i],255*fngrn[i],255*fnred[i]},{i,lo,hi}];
Export["N:\\Documents\\0 RA\\Software\\Radio-Sky Spectrograph\\Color File Maker\\AJ4CO-Rainbow-14-bit-Alternate2.txt",ColorDefs]

Colors;
ColorDefs=Table[{Round[65536*255*fnblu[i]+256*255*fngrn[i]+255*fnred[i]],255*fnblu[i],255*fngrn[i],255*fnred[i]},{i,lo,hi}];
Export["N:\\Documents\\0 RA\\Software\\Radio-Sky Spectrograph\\Color File Maker\\AJ4CO-Rainbow-14-bit-Alternate3.txt",ColorDefs]

Colors;
ColorDefs=Table[Round[65536*255*fnblu[i]+256*255*fngrn[i]+255*fnred[i]],{i,lo,hi}];
Export["N:\\Documents\\0 RA\\Software\\Radio-Sky Spectrograph\\Color File Maker\\AJ4CO-Rainbow-14-bit-Test2.txt",ColorDefs]

Color File Generator - Cross Polarization

(* Define domain of entire color scheme *)
lo=0;
hi=4095;
width=hi-lo; 

(* Define piecewise domain functions for red, green, blue *)

fnred1[x_]:=(((1-(((((width-2 (x+2047))/width)))^2)))^(1/2));
fnred2[x_]:=0;
fnred[x_]:=fnred1[x]/;0≤x≤2047;
fnred[x_]:=fnred2[x]/;2047<x≤4095;

fngrn1[x_]:=0;
fngrn2[x_]:=(((1-(((((width-2 (x-2047))/width)))^2)))^(1/2));
fngrn[x_]:=fngrn1[x]/;0≤x≤2047;
fngrn[x_]:=fngrn2[x]/;2047<x≤4095;

fnblu[x_]:=0;

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnred[x]+fngrn[x]+fnblu[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnred[x],fngrn[x],fnblu[x],fnsat[x]},{x,lo,hi},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnred[i],fngrn[i],fnblu[i]},{i,lo,hi}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]

(* Create Radio-Sky Spectrograph color definitions file *)
Colors;
ColorDefs=Table[65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],{i,lo,hi}];
Export["C:\\Program Files\\Spectrograph\\CrossPolarization.txt",ColorDefs]

Color File Generator - Cross Polarization2

(* Define domain of entire color scheme *)
lo=0;
hi=4095;
width=hi-lo; 

(* Define piecewise domain functions for red, green, blue *)

fnred1[x_]:=1-x/3000;
fnred2[x_]:=0;
fnred[x_]:=fnred1[x]/;0≤x≤3000;
fnred[x_]:=fnred2[x]/;3000<x≤4095;

fngrn1[x_]:=0;
fngrn2[x_]:=(x-1095)/3000;
fngrn[x_]:=fngrn1[x]/;0≤x≤1095;
fngrn[x_]:=fngrn2[x]/;1095<x≤4095;

fnblu[x_]:=0;

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnred[x]+fngrn[x]+fnblu[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnred[x],fngrn[x],fnblu[x],fnsat[x]},{x,lo,hi},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnred[i],fngrn[i],fnblu[i]},{i,lo,hi}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]

(* Create Radio-Sky Spectrograph color definitions file *)
Colors;
ColorDefs=Table[65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],{i,lo,hi}];
Export["C:\\Program Files\\Spectrograph\\CrossPolarization2.txt",ColorDefs]

Color File Generator - Cross Polarization3

(* Define domain of entire color scheme *)
lo=0;
hi=4095;
width=hi-lo; 

(* Define piecewise domain functions for red, green, blue *)

(*
fnLCP1[x_]:=1;
fnLCP2[x_]:=1-(x-1792)/512;
fnLCP3[x_]:=0;
fnLCP[x_]:=fnLCP1[x]/;0≤x≤1792;
fnLCP[x_]:=fnLCP2[x]/;1793≤x≤2303;
fnLCP[x_]:=fnLCP3[x]/;2304≤x≤4095;

fnRCP1[x_]:=0;
fnRCP2[x_]:=(x-1792)/512;
fnRCP3[x_]:=1;
fnRCP[x_]:=fnRCP1[x]/;0≤x≤1792;
fnRCP[x_]:=fnRCP2[x]/;1793≤x≤2303;
fnRCP[x_]:=fnRCP3[x]/;2304≤x≤4095;
*)

fnLCP1[x_]:=1;
fnLCP3[x_]:=0;
fnLCP[x_]:=fnLCP1[x]/;0≤x≤2303;
fnLCP[x_]:=fnLCP3[x]/;2304≤x≤4095;

fnRCP1[x_]:=0;
fnRCP3[x_]:=1;
fnRCP[x_]:=fnRCP1[x]/;0≤x≤1792;
fnRCP[x_]:=fnRCP3[x]/;1793≤x≤4095;

fnNoCP[x_]:=0;

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnNoCP[x]+fnRCP[x]+fnLCP[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnNoCP[x],fnRCP[x],fnLCP[x],fnsat[x]},{x,lo,hi},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnNoCP[i],fnRCP[i],fnLCP[i]},{i,lo,hi}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]

(* Create Radio-Sky Spectrograph color definitions file *)
Colors;
ColorDefs=Table[65536*Round[255*fnNoCP[i]]+256*Round[255*fnRCP[i]]+Round[255*fnLCP[i]],{i,lo,hi}];
Export["C:\\Program Files\\Spectrograph\\CrossPolarization3.txt",ColorDefs]

Color File Generator - Linear Only

(* Define domain of entire color scheme *)
lo=0;
hi=4095;
width=hi-lo; 

(* Define piecewise domain functions for red, green, blue *)
fnred[x_]:=x/width;

fngrn[x_]:=x/(2*width)+0.5;

fnblu[x_]:=1.0;

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnred[x]+fngrn[x]+fnblu[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnred[x],fngrn[x],fnblu[x],fnsat[x]},{x,lo,hi},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnred[i],fngrn[i],fnblu[i]},{i,lo,hi}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]

(* Create Radio-Sky Spectrograph color definitions file *)
Colors;
ColorDefs=Table[65536*Round[255*fnblu[i]]+256*Round[255*fngrn[i]]+Round[255*fnred[i]],{i,lo,hi}];
Export["C:\\Program Files\\Spectrograph\\blue-white.txt",ColorDefs]

All Color Files Parser

InFileList={
"AJ4CO-Rainbow.txt",
"blkblugrnyelred.txt",
"blueyellowred.txt",
"Blk2Wht.txt",
"blkblugrnyel.txt",
"BlkGrnWht.txt",
"BlkMagYel1.txt",
"BlkOrangeYel.txt",
"BlkRedYel2.txt",
"BlkYelWht.txt",
"BluGrnRedYel1.txt",
"BluGrnYelRed1.txt",
"BluRedYel1.txt",
"BluRedYel3.txt",
"GrnYelOrRed.txt",
"GryBluGrnYel.txt",
"GryGrnYelRed.txt",
"Wht2Blk.txt"
};
FileCount=Dimensions[InFileList][[1]];
Results=Table[{"",""},{i,1,FileCount}];
Do[{
ColorInFile=Import["C:\\Program Files\\Spectrograph\\"<>InFileList[[i]],"Data"];
lo=1;
hi=Dimensions[ColorInFile][[1]];
ColorsIn ={
FractionalPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256]*256,
IntegerPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256],
IntegerPart[ColorInFile[[All,1]]/65536]
};
ColorsInT=Transpose[ColorsIn];
ColorsIn=ColorsIn/255;
ColorsInT=ColorsInT/255;
SatIn=(ColorsIn[[1]]+ColorsIn[[2]]+ColorsIn[[3]])/3;
Results[[i,1]]=ListLinePlot[{ColorsIn[[1]],ColorsIn[[2]],ColorsIn[[3]],SatIn},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}},ImageSize->350];
Results[[i,2]]=Graphics[Raster[{ColorsInT}],AspectRatio->.2,ImageSize->350];
}
,{i,1,FileCount}
];
Rows=Ceiling[FileCount/3];
OutPanels=Table[{0},{i,1,Rows},{j,1,3}];
Do[{
Do[{
OutPanels[[i+1,j]]=Panel[Column[{InFileList[[3 i+j]],Results[[3 i+j,1]],Results[[3 i+j,2]]}],ImageSize->370];
}
,{j,1,3}
];
}
,{i,0,Rows-1}
];
Grid[OutPanels]
Export["C:\\Program Files\\Spectrograph\\Outpanels.pdf",Grid[OutPanels],"PDF"]

SIngle Color File Parser

ColorInFile=Import["C:\\Program Files\\Spectrograph\\"<>"AJ4CO-Rainbow.txt","Data"];
lo=1;
hi=Dimensions[ColorInFile][[1]];
ColorsIn ={
FractionalPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256]*256,
IntegerPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256],
IntegerPart[ColorInFile[[All,1]]/65536]
};
ColorsInT=Transpose[ColorsIn];
ColorsIn=ColorsIn/255;
ColorsInT=ColorsInT/255;
SatIn=(ColorsIn[[1]]+ColorsIn[[2]]+ColorsIn[[3]])/3;
ListLinePlot[{ColorsIn[[1]],ColorsIn[[2]],ColorsIn[[3]],SatIn},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}},ImageSize->350]
Graphics[Raster[{ColorsInT}],AspectRatio->.2]

Color Scale Maker

ColorOffset=1550;
ColorGain=1.8;
ScaleWidth=4096;

StepCalInFile=Import["F:\\Hardware\\SDR-14\\Step Cal\\"<>"AJ4CO RSS Step Cal 20100812.csv","Data"];
StepCalInFile[[All,2]]=(StepCalInFile[[All,2]]-ColorOffset)*ColorGain;
ListLogLinearPlot[StepCalInFile]

iFn[x_]:=Interpolation[StepCalInFile][x];

Print["For a scale width of ",ScaleWidth," pixels:"]
Print["26 kK at ",iFn[26]*ScaleWidth/1024]
Print["50 kK at ",iFn[50]*ScaleWidth/1024]
Print["55 kK at ",iFn[55]*ScaleWidth/1024]
Print["100 kK at ",iFn[100]*ScaleWidth/1024]
Print["200 kK at ",iFn[200]*ScaleWidth/1024]
Print["300 kK at ",iFn[300]*ScaleWidth/1024]
Print["500 kK at ",iFn[500]*ScaleWidth/1024]
Print["700 kK at ",iFn[700]*ScaleWidth/1024]
Print["1 MK at ",iFn[1000]*ScaleWidth/1024]
Print["1.2 MK at ",iFn[1200]*ScaleWidth/1024]
Print["1.5 MK at ",iFn[1500]*ScaleWidth/1024]
Print["1.96 MK at ",iFn[1960]*ScaleWidth/1024]
Print["2 MK at ",iFn[2000]*ScaleWidth/1024]
Print["5 MK at ",iFn[5000]*ScaleWidth/1024]
Print["10 MK at ",iFn[10000]*ScaleWidth/1024]
Print["20 MK at ",iFn[20000]*ScaleWidth/1024]
Print["50 MK at ",iFn[50000]*ScaleWidth/1024]
Print["100 MK at ",iFn[100000]*ScaleWidth/1024]
Print["135 MK at ",iFn[135000]*ScaleWidth/1024]

ColorInFile=Import["C:\\Program Files\\Spectrograph\\"<>"AJ4CO-Rainbow.txt","Data"];
lo=1;
hi=Dimensions[ColorInFile][[1]];
ColorsIn ={
FractionalPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256]*256,
IntegerPart[FractionalPart[ColorInFile[[All,1]]/65536]*65536/256],
IntegerPart[ColorInFile[[All,1]]/65536]
};
ColorsInT=Transpose[ColorsIn];
ColorsInT=ColorsInT/255;
xticks={{1.`,Rotate["26 kK",-π/2],{0.01`,0},{}},
{293.`,Rotate["50 kK",-π/2],{0.01`,0},{}},
{764.`,Rotate["100 kK",-π/2],{0.01`,0},{}},
{1379.`,Rotate["200 kK",-π/2],{0.01`,0},{}},
{1792.`,Rotate["300 kK",-π/2],{0.01`,0},{}},
{2354.`,Rotate["500 kK",-π/2],{0.01`,0},{}},
{2810.`,Rotate["700 kK",-π/2],{0.01`,0},{}},
{3229.`,Rotate["1.0 MK",-π/2],{0.01`,0},{}},
{3738.`,Rotate["1.5 MK",-π/2],{0.01`,0},{}},
{4080.`,Rotate["2.0 MK",-π/2],{0.01`,0},{}}};
Rotate[Graphics[Raster[{ColorsInT}],AspectRatio->.07,Frame->True,FrameLabel->"Antenna Temperature",LabelStyle->Directive[FontFamily->"Arial",FontSize->12],FrameTicks->{xticks,None,None,None},Background->RGBColor[.847,.847,.847],ImageSize->410],π/2]

Extras

width=100; 
(* Define functions for red, green, blue *)
fnred[x_]:=x*1/width+0.866025/;0≤x≤(width-86.6025);
fnred[x_]:=1/;x>(width-86.6025);
fngrn[x_]:=x*1/width;
fnblu[x_]:=x*1/width+0.866025/;0≤x≤(width-86.6025);
fnblu[x_]:=1/;x>(width-86.6025);

(* Define a saturation function for reference use *)
fnsat[x_]:=(fnred[x]+fngrn[x]+fnblu[x])/3;

(* Plot red, green and blue functions along with saturation *)
Plot[{fnred[x],fngrn[x],fnblu[x],fnsat[x]},{x,0,width},PlotStyle->{{RGBColor[1,0,0],Thin},{RGBColor[0,1,0],Thin},{RGBColor[0,0,1],Thin},{RGBColor[.6,.6,.6],Thin}}]

(* create a table of "width" number of RGB value triplets, each value ranging from 0 to 1 *)
Colors=Table[{fnred[i],fngrn[i],fnblu[i]},{i,0,width}];

(* plot the color table ceated above *)
Graphics[Raster[{Colors}],AspectRatio->.2]