#=======================================================================
# Blue-red scale color map (going from dark to light blue, then light
# to dark red, in going from color index 16 to 239).  The blue to
# red transition happens between indices 127 and 128.
#
# Copyright (c) 2003 by Johnny Lin.  For licensing, distribution
# conditions, contact information, and additional documentation see
# the URL http://www.johnny-lin.com/pylib.html#license.
#=======================================================================


#- Import modules and open VCS canvas:

import vcs
v = vcs.init()


#- Copy the default color map to create my own color map "my_cmap":

my_cmap = v.createcolormap('my_cmap', 'default')


#- Compute RGB values and fill the my_cmap.index dictionary for
#  color indices 16 to 239:  blue is indices 16-127, red is
#  indices 128-239:

for icell in range(16,128):
    rvalue = int( float(icell-16)/(127.-16.) * 75. )
    gvalue = rvalue
    bvalue = 100
    my_cmap.index[icell] = [rvalue, gvalue, bvalue]
for icell in range(128,240):
    rvalue = 100
    gvalue = 75 - int( float(icell-128)/(239.-128.) * 75. )
    bvalue = gvalue
    my_cmap.index[icell] = [rvalue, gvalue, bvalue]


#- Set my color map to the active color map:

v.setcolormap('my_cmap')




#====== end of file ======
