next up previous contents index
Next: Revert all RGB values Up: VMD Script Commands for Previous: Changing the color scale   Contents   Index


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
  set coloridcount [colorinfo num]
  set colordiv [expr $coloridcount - 1.0]
  for {set i 0} {$i < $coloridcount} {incr i} {
    set val [expr $i / $colordiv]
    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.



vmd@ks.uiuc.edu