omnicanvas.colors (Tools for processing colours)

This module contains various functions usued internally to process colours, mainly for validation pruposes currently.


Raises exceptions if a colour does not meet requirements.


color (str) – The colour to check.

  • TypeError – if the colour is not a string.
  • ValueError – if the colour is not valid.

Checks that a given string represents a valid hex colour.

Parameters:color (str) – The color to check.
Return type:bool
omnicanvas.colors.hsl_to_rgb(hue, saturation, lightness)[source]

Takes a colour in HSL format and produces an RGB string in the form #RRGGBB.

  • hue – The Hue value (between 0 and 360).
  • saturation – The Saturation value (between 0 and 100).
  • lightness – The Lightness value (between 0 and 100).

ValueError – if any of the three parameters are outside their bounds.