pygal.colors module

This package is an utility package oriented on color alteration. This is used by the 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


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


Round float errors


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