color

Colors can be specified using one of five formats:

"#%2x%2x%2x" Red-Green-Blue (RGB)
"#%1x%1x%1x" Shorthand Red-Green-Blue (RGB)
"#%2x%2x%2x%2x" Red-Green-Blue-Alpha (RGBA)
"H[, ]+S[, ]+V" Hue-Saturation-Value (HSV) 0.0 <= H,S,V <= 1.0
"H[, ]+S[, ]+V[, ]A" Hue-Saturation-Value-Alpha (HSVA) 0.0 <= H,S,V,A <= 1.0
string color name

The specification for the RGB and RGBA formats are the format strings used by sscanf to scan the color value. Thus, these values have the form "#RGB" or "#RGBA", where R, G, B, and A each consist of 2 hexadecimal digits, and can be separated by whitespace. As of Graphviz 9.0.0, RGB components can also be given as 1 hexadecimal digit. These are each doubled to form 2-digit components, similar to shorthand HTML colors. HSV colors have the form of 3 or (as of Graphviz 8.0.1) 4 numbers between 0 and 1, separated by whitespace or commas.

String-valued color specifications are case-insensitive and interpreted in the context of the current color scheme, as specified by the colorscheme attribute. If this is undefined, the X11 naming scheme will be used. An initial "/" character can be used to override the use of the colorscheme attribute. In particular, a single initial "/" will cause the string to be evaluated using the default X11 naming. If the color value has the form "/ssss/yyyy", the name yyyy is interpreted using the schema ssss. If the color scheme name is empty, i.e., the color has the form "//yyyy", the colorscheme attribute is used. Thus, the forms "yyyy" and "//yyyy" are equivalent.

At present, Graphviz recognizes the default color scheme X11, and the Brewer color schemes (cf. ColorBrewer). Please note that Brewer color schemes are covered by this license.

Examples:

Color RGB HSV String
White "#ffffff" "0.000 0.000 1.000" "white"
Black "#000000" "0.000 0.000 0.000" "black"
Red "#ff0000" "0.000 1.000 1.000" "red"
Turquoise "#40e0d0" "0.482 0.714 0.878" "turquoise"
Sienna "#a0522d" "0.051 0.718 0.627" "sienna"

The string value transparent can be used to indicate no color. This is only available in the output formats ps, svg, fig, vmrl, and the bitmap formats. It can be used whenever a color is needed but is most useful with the bgcolor attribute. Usually, the same effect can be achieved by setting style to invis.

Attributes

color is a valid type for:
Last modified September 16, 2023: add documentation for 3-digit RGB colors (9391732)