next up previous contents
Next: ColorUser Up: ColorList Previous: Internal data structures

Method of use

VMD contains one global instance of this class, colors. It is used by all objects derived from ColorUser, which includes all Displayable objects as well as DisplayDevice. An object which wishes to allow the user to be able to change its colors goes through these steps:

  1. call ColorList::_color_category(char *) ; this adds a new category with the given name and returns a unique index for that category, or else returns the index of the category if it already exists. This index should be saved for later use.
  2. once a category exists, names should be added to the category that correspond to all the components that can be configured, with default colors. This is done by doing the following: (colors->color_category(catIndex))->add_name("item name", defaultColor)
  3. When the colors have been added, they may be retrieved later when creating a display list by doing the following: (colors->color_category(catIndex))->data("item name")

    This will return the index of the color assigned to the given item name.



Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999