% GUImakecolmap
% Function to create a colormap for the MODIS GUI.
% Copyright by Jasmine S Nahorniak, Oregon State University. 
% Mar 21 2000
% [newcolmap]=makecolmap(scolor,ecolor,numcols,vartype);
% newcolmap : custom colormap
% scolor: starting color (eg [1 0 0])
% ecolor: ending color (eg [0 1 0])
% numcols: number of colors
% vartype: linear ('lin'), log ('log'), or exponential ('exp') color variation

function [newcolmap]=GUImakecolmap(scolor,ecolor,numcols,vartype);

GUIdefaults;

newcolmap(1,:)=guilandcolor;
newcolmap(2,:)=guimaskcolor;

for i=1:numcols,
     tempcolmap(i,:)=scolor+((i-1)/(numcols-1))*(ecolor-scolor);
end

if vartype=='lin',

  newcolmap(3:numcols+2,:)=tempcolmap;

elseif vartype=='log',
  
  newcolmap(3:numcols+2,:)=brighten(tempcolmap,0.5);

elseif vartype=='exp',
  
  newcolmap(3:numcols+2,:)=brighten(tempcolmap,-0.5);

end

figure
colormap(newcolmap)
colorbar
