Skip to main content

Module color

Module color 

Source
Expand description

Color translation tables, hex/HSV parsing, and SVG color formatting ported from Graphviz 16.1.0 (lib/common/colxlate.c, lib/common/colortbl.h, lib/common/color.h).

Structs§

RgbaColor
Resolved 8-bit RGBA color (r, g, b, a).

Functions§

format_svg_color
Formats a Graphviz color spec into an SVG color string (#rrggbb, #rrggbbaa, or "none"), falling back to "black" (#000000) if unknown.
hsv2rgb
Port of hsv2rgb from lib/common/colxlate.c.
resolve_color
Resolves a Graphviz color specification (#rgb, #rgba, #rrggbb, #rrggbbaa, "h,s,v", "h s v", or X11/SVG/Brewer named color) to an RgbaColor.
resolve_color_with_scheme
Resolves a Graphviz color specification with an optional active colorscheme, following colorxlate in lib/common/colxlate.c. Returns None for an unknown color (C yields opaque black and warns; see warn_unknown_color).
rgb2hsv
Port of rgb2hsv from lib/common/colxlate.c.
warn_unknown_color
Prints Warning: <name> is not a known color. to stderr, once per distinct name, like gvrender_resolve_color.