function map = bichromatic(cols,varargin)
%Bichromatic colormap: bichromatic(cols,varargin)
%
% Examples:
% map = bichromatic;
% map = bichromatic(cols);
% map = bichromatic([],len);
% B = bichromatic(cols, A);
% B = bichromatic(cols, A, lims);
%
% Similar to other colormap functions that interpolate between 2 fixed colors
% except the colors are variable.
%
% The function can additionally be used to convert a real-valued array into
% a truecolor array using the colormap.
%
% IN:
% len - Scalar length of the output colormap. If len == Inf the concise
% table is returned. Default: len = size(get(gcf, 'Colormap'), 1);
% A - Non-scalar numeric array of real values to be converted into
% truecolor.
% lims - 1x2 array of saturation limits to be used on A. Default:
% [min(A(:)) max(A(:))].
% cols - a 2X3 matrix with 2 RGB vectors. Note cols(1,:) is the low
% color, cols(2,:) is the high valued color. If cols = [], defaults
% to grayscale
%
% OUT:
% map - (len)xJ colormap table. J = 3, except in the concise case, when
% J = 4, map(1:end-1,4) giving the relative sizes of the
% inter-color bins.
% B - size(A)x3 truecolor array.
% Based on Oliver Woodford's colormap/real2rgb submission in the MATLAB FEX
if isempty(cols) || (nargin == 0)
cols = [0 0 0;1 1 1];
end
map = [cols(1,:); cols(2,:)];
map = colormap_helper(map, varargin{:});