Rainbow colors successive residues or chains incrementally over a specified color range. If level is residue or residues, the color is incremented by residue; if level is chain or chains, the color is incremented by chain. Two or more color names color1, color2, etc. can be supplied as a comma-separated list. Each color name can be one of the built-in names or a name defined previously with colordef. If two names are given, they designate the starting and ending colors; if more than two names are given, they designate the starting color, intermediate color(s), and ending color.
The default level is residue and the default color range is defined by blue, cyan, green, yellow, and red, in that order. Even if a narrower atom-spec is supplied, the entire model(s) containing the specified atoms will be affected. If no atoms are specified, all molecule models will be affected. Thus, rainbow without any arguments colors each peptide chain blue to red from N-terminus to C-terminus.
When the increment is by residue, each chain is rainbow-colored separately. Rainbow spreads the color gradient across each entire chain in the specified model(s), even if part of the chain is not displayed. WATER and HET chains are not affected.
Visible atom color is determined by a hierarchy; briefly, atom colors assigned on a per-atom basis and ribbon colors assigned on a per-residue basis override the model-level color. The command rainbow sets both individual atom colors (although atoms within a residue are given the same color) and per-residue ribbon colors.