ChimeraX docs icon

Command: color, rainbow

The color command colors atomic models, including atoms, bonds, pseudobonds, cartoons, and molecular surfaces. It can also apply to nonmolecular surfaces, depending on the type of coloring:

See examples below. See also: transparency, mlp, measure convexity, surface, volume, Basic Actions, Molecule Display Toolbar, initial colors, color names, palettes

Additional subcommands manage the set of named colors:

Simple Coloring

Usage: color  spec   colorname  [ target  string ] [ halfbond  true | false ] [ transparency  percent ]

Simple coloring applies to atomic models, including cartoon and molecular surface representations, and volume data (map) displays. The colorname can be:

The target option allows coloring only a subset of the possible displays of a given atom, residue, etc. The string can be any combination of the following letters, without commas or spaces:

The default is all of the above, plus 3D labels in the case of simple coloring. 3D labels can be colored independently with the label command.

Alternatively, for simple coloring only, targets can be specified with one or more of the following keywords as a comma-separated list immediately after the colorname (or for color modification, at the end of the command):

By default, bonds are shown in halfbond mode, with color and transparency settings from the flanking atoms. Setting halfbond false for a bond (or pseudobond) reveals its own color/transparency settings independent of the atoms. This option can be used to toggle halfbond mode regardless of whether the command colors any bonds. It affects only the specified bonds (not pseudobonds), except obeying the target setting when it includes p.

The transparency option sets transparency to the specified percent, where 0% is completely opaque and 100% is completely transparent. Existing transparency is not changed unless this option is used or the colorname explicitly specifies alpha (opacity). An alpha value overrides this option if both are given. Note that the transparency command can be used to set transparency apart from color.

Sequential Coloring (Rainbow)

Usage: color  sequential  atom-spec  [ level ] [ target  string ] [ palette  palette ] [ transparency  percent ]
– or –
Usage: rainbow  atom-spec  [ level ] [ target  string ] [ palette  palette ] [ transparency  percent ]

The color sequential command (synonym rainbow, see examples) applies a series of colors to atomic models at the specified level:

The level can be omitted and defaults to residues. Sequential coloring applies to all atoms within the affected residues, chains, or models even if fewer atoms are specified, but can be restricted to certain representations with the target option. The palette option specifies what colors to use, and transparency can be set independently.

Color Modification

Usage: color modify  spec   hue  [ + | − ]  angle  [ target  string ]
Usage: color modify  spec  ( saturation | lightness | whiteness | blackness | red | green | blue ) [ + | − | * ]  percent  [ target  string ]
Usage: color modify  spec  contrastpercent ] [ target  string ]

Color modification adjusts existing colors. It applies to atomic models, including cartoon and molecular surface representations. The color component to modify must be specified, with choices:

For saturation, lightness, whiteness, blackness, red, green, or blue, the percent can be added to (+), subtracted from (−), or multiplied by (*) the current value, or simply set as the current value if no operator symbol is given (or the space after the operator symbol is omitted; the space is needed to indicate a change from the current value rather than an absolute value). For hue, the angle can be added to or subtracted from the current value, or simply set as the current value.

Coloring by Map Value

Usage: colorsample | electrostatic | gradient )  surf-spec  map  map-model  [ offset  d ] [ transparency  percent ]  palette-options 

Coloring by map (volume data) value applies to surfaces only, both molecular and nonmolecular. The color-to-value mapping is specified with palette options, and transparency can be set independently. See also: mlp

Coloring by Distance

Usage: color  radial  surf-spec  [ center  atom-spec | x,y,z ] [ coordinateSystem  model-spec ]  palette-options 
Usage: colorcylindrical | height )  surf-spec  [ center  atom-spec | x,y,z ] [ axis  vector ] [ coordinateSystem  model-spec ]  palette-options 

Coloring by distance applies to surfaces only, both molecular and nonmolecular (such as volume isosurfaces). The color-to-distance mapping is specified with palette options.

The axis vector can be expressed as:

A reference model for center and vector coordinates can be specified with the coordinateSystem option. If no reference model is given, the scene coordinate system will be used for the center and the screen coordinate system (X horizontal, Y vertical, Z in/out) for the axis when they are given as coordinates (as opposed to an atom-spec).

Coloring by Zone

Usage: color  zone  surf-spec  near  atom-spec  [ distance  cutoff ] [ sharpEdges  true | false ]

Coloring by zone to match nearby atoms or markers applies to nonmolecular surfaces only. The cutoff is specified in physical units of distance, typically Å (default 2.0). When multiple specified atoms fall within the cutoff distance of a surface vertex, the vertex will be colored to match the closest one. Vertices not within the cutoff of any of the atoms are assigned the default color of the surface model (single-color mode). The sharpEdges option (default false) subdivides surface triangles to create sharp boundaries between the different colored regions.

Palette Options

A palette is an ordered set of colors or value,color pairs used for sequential coloring or coloring by map value. See also: mlp, measure convexity

palette  palette
Specify a palette as one of the following:
range  low,high | full
For numerical data only (not sequential coloring), what values should map to the extremes of the palette (default full, the minimum and maximum values for the items to be colored). Alternatively, low and high values separated by a comma only can be supplied. When multiple models are colored in a single command, the full range is determined separately for each model.

Examples

Color chain D helices sky blue, cartoons only (not atoms, etc.):
color /d & helix  sky blue  target c
– or –
color /d & helix  sky blue  cartoons
Color residues 12 and 260-275 in chains A and B, atoms/bonds only:
color /A,B:12,260-275  hot pink  target a
– or –
color /A,B:12,260-275  hot pink  atoms
Color all pseudobonds yellow:
color pbonds  yellow
Restore original model coloring to all carbon atoms:
color C  bymodel  targ a
Rainbow-color residues blue → red along each biopolymer chain:
color seq res
– or –
rainbow res
– or –
rainbow
Color the unique biopolymers in each atomic model, cartoons only, along the range cornflower blue → red → gold (chains that are the same biopolymer will be the same color):
color seq polymers  targ c  palette cornflowerblue:red:gold
– or –
rainbow polymers  targ c  palette cornflowerblue:red:gold
Color the protein 10-mer in PDB entry 1qmv using the 10-color version of the “paired” ColorBrewer palette:
open 1qmv; rainbow protein chain palette paired-10

Defining and Listing Colors

Usage:
color name  cname  color-spec

Usage:
color deletecname | custom )

Usage:
color listall | builtin | custom ]

Usage:
color show  cname

The command color name assigns cname as the name of the specified color. It can be used to define a new color name or redefine an existing one. Color names must begin with an alphabetical letter and may contain only lowercase letters, numbers, hyphens, underscores, and spaces. If cname has embedded spaces, it must be enclosed in quotation marks.

Examples:
color name tpurple 60,0,80,50
color name tgreen rgba(0%, 80%, 40%, 0.5)

The command color delete can be used to “forget” a specific user-defined color or all custom (user-defined) colors. A built-in color name cannot be deleted.

The command color list lists color names along with color swatches in the Log, with options:

The command “color show cname” reports in the Log the rgba (red, green, blue, opacity) definition of an existing color named cname. See also: palette list


UCSF Resource for Biocomputing, Visualization, and Informatics / April 2018