pygal.colors module

This package is an utility package oriented on color alteration. This is used by the pygal.style package to generate parametric styles.

pygal.colors.adjust(color, attribute, percent)[source]

Adjust an attribute of color by a percent

pygal.colors.darken(color, percent)[source]

Darken a color by decreasing its lightness by percent

pygal.colors.desaturate(color, percent)[source]

Desaturate a color by decreasing its saturation by percent

pygal.colors.hsl_to_rgb(h, s, l)[source]

Convert a color in h, s, l to a color in r, g, b

pygal.colors.is_foreground_light(color)[source]

Determine if the background color need a light or dark foreground color

pygal.colors.lighten(color, percent)[source]

Lighten a color by increasing its lightness by percent

pygal.colors.normalize_float(f)[source]

Round float errors

pygal.colors.parse_color(color)[source]

Take any css color definition and give back a tuple containing the r, g, b, a values along with a type which can be: #rgb, #rgba, #rrggbb, #rrggbbaa, rgb, rgba

pygal.colors.rgb_to_hsl(r, g, b)[source]

Convert a color in r, g, b to a color in h, s, l

pygal.colors.rotate(color, percent)[source]

Rotate a color by changing its hue value by percent

pygal.colors.saturate(color, percent)[source]

Saturate a color by increasing its saturation by percent

pygal.colors.unparse_color(r, g, b, a, type)[source]

Take the r, g, b, a color values and give back a type css color string. This is the inverse function of parse_color