Command-Line Color Specification
Colors can be specified in commands with:
- CSS color names except in lowercase only,
optionally with spaces between words
- color names defined previously with the
colordef command
- CSS hex format (hexadecimal)
- CSS-like format for colorspaces:
- rgb - red, green, blue
- rgba - red, green, blue, opacity
- hsl - hue, saturation, lightness
- hsla - hue, saturation, lightness, opacity
- gray - grayscale
The colorspace name must be in lowercase
and immediately precede the open parenthesis.
Otherwise, embedded spaces are allowed.
Opacity is always within the range 0-1, whereas the remaining components
may be expressed on a scale of 0 to 255, or as percentages
(indicated with a percent sign), or as fractional values within the range 0-1
(indicated with a decimal point, for example, 1.0 rather than 1).
RGB or HSL components within a single specification
must be expressed on the same scale.
Color names from CSS or colordef
can be truncated, with ambiguous truncations
going to the shortest of the matching full color names.
Examples
The following all specify the same color:
red
#f00
#0xff0000
rgb(255, 0, 0)
rgb(1.0,0,0)
rgb(100%, 0, 0)
rgba(100%, 0, 0, 1)
hsl(0, 100%, 50%)
The following specify the same shade of gray:
gray(128)
gray(50%)
UCSF Resource for Biocomputing, Visualization, and Informatics /
September 2015