omnicanvas.colors
(Tools for processing colours)¶
This module contains various functions usued internally to process colours, mainly for validation pruposes currently.
-
omnicanvas.colors.
process_color
(color)[source]¶ Raises exceptions if a colour does not meet requirements.
Parameters: color (str) – The colour to check.
Raises: - TypeError – if the colour is not a string.
- ValueError – if the colour is not valid.
-
omnicanvas.colors.
is_valid_color
(color)[source]¶ 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.
Parameters: - hue – The Hue value (between 0 and 360).
- saturation – The Saturation value (between 0 and 100).
- lightness – The Lightness value (between 0 and 100).
Raises: ValueError – if any of the three parameters are outside their bounds.