jicbioimage.core.util.color
¶
Module for generating RGB tuples for use as colors in images.
-
jicbioimage.core.util.color.
identifier_from_unique_color
(unique_color)[source]¶ Return identifier from unique RGB tuple.
Parameters: unique_color – RGB tuple Returns: positive integer in range from 0 to 16777215 inclusive
-
jicbioimage.core.util.color.
pretty_color_from_identifier
(identifier)[source]¶ Return deterministic aesthetically pleasing RGB tuple.
Returns: RGB tuple
-
jicbioimage.core.util.color.
pretty_color_palette
(identifiers, keep_zero_black=True)[source]¶ Return dictionary with pretty colors.
Parameters: - identifiers – set of unique identifiers
- keep_zero_black – whether or not the background should be black
Returns: dictionary
-
jicbioimage.core.util.color.
random_pretty_color
()[source]¶ Return random aesthetically pleasing RGB tuple.
Returns: RGB tuple
-
jicbioimage.core.util.color.
unique_color_from_identifier
(identifier)[source]¶ Return unique color as RGB tuple.
Useful for creating PNG images where each color is used as an identifier.
Raises TypeError if the identifier is not an integer.
Raises ValueError if the identifier is not in the range 0 to 16777215 inclusive.
Parameters: identifier – positive integer in range from 0 to 16777215 inclusive Raises: TypeError, ValueError Returns: RGB tuple