Color¶
-
class
colorpalette.
Color
[source]¶ Create a Color object that can color/style strings. Color objects are an extension of the color function in the ansicolors package <https://pypi.org/project/ansicolors/>`__.
Parameters: - ID: str
Name of color.
- fg: str
Foreground color.
- bg: str
Background color.
- style: str
Options include ‘bold’, ‘underline’, or None
Notes
- Both fg and bg should be one of the following [-]:
- 3-element tuple or list of int, each valued 0 to 255 (e.g. (255, 218, 185)),
- string containing a CSS-compatible color name (e.g. ‘peachpuff’),
- string containing a CSS-style hex value (e.g. ‘#aaa’ or ‘#8a2be2’)
- string containing a CSS-style RGB notation (e.g. ‘rgb(102,51,153)’)
- None
Examples
-
ansi
¶ [str] Ansi color code.
-
RGB
¶ [array] Foreground color in RGB on a 0-255 scale.
-
RGB_bg
¶ [array] Background color in RGB on a 0-255 scale.
-
RGBn
¶ [array] Foreground color in RGB on a normalized 0-1 scale.
-
RGBn_bg
¶ [array] Background color in RGB on a normalized 0-1 scale.
-
HEX
¶ [str] Foreground color in HEX code.
-
HEX_bg
¶ [str] Background color in HEX code.