The command rainbow colors successive residues, chains, or models over a specified color range. If level is residue or residues (the default), the color changes per residue, starting over for each chain. If level is chain or chains, the color changes per chain, starting over for each model (where "model" indicates a submodel or a model that is not subdivided into submodels). WATER and HET chains are not affected when the color is changed per residue or chain. If level is model or models, the color changes per model.
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 color range is defined by blue, cyan, green, yellow, and red, in that order. The Rainbow tool is a graphical implementation of rainbow in which five colors are used.
If no atoms are specified, all molecule models will be affected. Thus, rainbow without any arguments will color the residues in each polymer chain from blue to red (peptides from N-terminus to C-terminus, nucleic acids from 5' end to 3' end). Although a narrower atom-spec may be supplied, the entire model(s) containing the specified atoms will be affected. The coloring cannot be limited to a subset of the residues in a chain or a subset of the polymer chains in a model, although it can be limited to a subset of the open submodels/models.
Apparent 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 rainbow command always sets individual atom colors and per-residue ribbon colors; in addition, model-level colors are set when the color is changed per model.
See also: color, rangecolor, ribcolor, ribbon, surfcolor, the Rainbow tool