next up previous contents index
Next: Creating a set of Up: VMD Script Commands for Previous: Adjusting the degree of

Changing the color scale definitions

  Suppose that of the 32 colors, the first 15 should be red, then 2 whites, and finally 15 blues. You can use the `color' command to modify the color scale values accordingly. The only sticky point is that you must update the transparent definitions as well or things might look strange.

proc tricolor_scale {} {
  set color_start [expr [colorinfo num] * 2]
  for {set i 0} {$i < 32} {incr i} {
    if {$i == 0} {
      set r 1;  set g 0;  set b 0
    }
    if {$i == 15} {
      set r 1;  set g 1;  set b 1
    }
    if {$i == 17} {
      set r 0;  set g 0;  set b 1
    }
    color change rgb [expr $i + $color_start     ] $r $g $b
    # get the transparent version as well
    color change rgb [expr $i + $color_start + 32] $r $g $b
  }
}

tricolor_scale



Justin Gullingsrud
Tue Apr 6 09:22:39 CDT 1999