next up previous contents index
Next: 6.4.4 Revert all RGB Up: 6.4 VMD Script Commands Previous: 6.4.2 Changing the color

6.4.3 Creating a set of black-and-white color definitions

      To map grayscale on the color ids 0-16 (0=black; 16=white):

proc make_grayscale {} {
  display update off
  for {set i 0} {$i < 17} {incr i} {
    set val [expr $i / 16.0]
    color change rgb $i $val $val $val
  }
  display update on
}
Note that the display updates are switched off for the time of redefinition, so that the screen would not be redrawn every time one color is changed. This way the procedure works faster. The only bad thing about this idea is that black becomes white, and white changes too, so the names of the colors (yellow, orange, etc.) become useless.



Sergei Izrailev
Fri Jul 25 17:07:27 CDT 1997