Methods for changing how VMD colors things. Can be useful for rendering from the Python API.

Basic colors

VMD defines many colors by name. You can actually assign any RGB value to these names. However, you currently cannot add additional colors. For use of many colors, see below for how to use color scales.

get_colors Get all legal color names and corresponding RGB values.
get_colorlist Get list of all defined colors by RGB value
set_colors Change the RGB values for named colors.
set_colorid Set RGB value of a color at a given index
categories Get available color categories

Color mappings

VMD likes to classify colors into categories. For example, the “Name” category is used when coloring atoms by name. The “Type” category is used to color atoms by type, etc. Some categories are used for internal display purposes, such as the “Display” and “Axes” categories.

Changing the color mappings can be useful for things like coloring the carbons in a ligand differently than those in the protein, while preserving the standard coloring scheme for other elements.

>>> from vmd import color
>>> color.set_colormap("Type", {"C": "green3"})
get_colormap Get name/color pairs in a given colormap category
set_colormap Update name/color pairs in given color category

Color scale

The color scale is used for coloring continuous values, such as the “User” or “Charge” coloring schemes. It’s a gradient of color with a minimum, middle, and maximum value.

>>> from vmd import color
>>> color.scale_methods()
['RWB', 'BWR', 'RGryB', 'BGryR', 'RGB', 'BGR', 'RWG', 'GWR', 'GWB', 'BWG', 'BlkW', 'WBlk']
scale_method Get the current colorscale method
scale_methods Get list of available colorscale methods
scale_midpoint Get current colorscale midpoint value
scale_min Get current colorscale minimum value
scale_max Get current colorscale max.
set_scale Set colorscale parameters.