Module colors¶
Functions for converting colors from one representation to another.
See also
- W3C-Wiki:
- Wikipedia:
Overview¶
Return an iterator over all HTML/CSS color names. |
|
Convert a RGB-triple with floats to one with ints. |
|
Convert from hexadecimal to RGB. |
|
Return whether name is a valid color name. |
|
Return the hexadecimal string for name. |
|
Return the RGB values for name. |
|
Convert a RGB-triple with ints to one with floats. |
|
Convert from RGB to hexadecimal. |
-
salmagundi.colors.
floats2rgb
(rgb)[source]¶ Convert a RGB-triple with floats to one with ints.
Useful when using functions that take or return RGB values as floats from 0 to 1, e.g. the functions in module
colorsys
.- Parameters
rgb (tuple(float, float, float)) – RGB-triple with values ∈ [0, 1]
- Returns
RGB-triple with values ∈ [0..255]
- Return type
New in version 0.2.0.
-
salmagundi.colors.
rgb2floats
(rgb)[source]¶ Convert a RGB-triple with ints to one with floats.
Useful when using functions that take or return RGB values as floats from 0 to 1, e.g. the functions in module
colorsys
.- Parameters
rgb (tuple(int, int, int)) – RGB-triple with values ∈ [0..255]
- Returns
RGB-triple with values ∈ [0, 1]
- Return type
New in version 0.2.0.
-
salmagundi.colors.
rgb2hex
(r, g, b)[source]¶ Convert from RGB to hexadecimal.
- Parameters
- Returns
hexadecimal string (# + 6 hex digits)
- Return type
- Raises
ValueError – if one of the arguments is not in [0..255]