rich.color
- class rich.color.Color(name, type, number=None, triplet=None)[source]
Terminal color definition.
- classmethod default()[source]
Get a Color instance representing the default color.
- Returns:
Default color.
- Return type:
- downgrade(system)[source]
Downgrade a color system to a system with fewer colors.
- Parameters:
system (ColorSystem)
- Return type:
- classmethod from_rgb(red, green, blue)[source]
Create a truecolor from three color components in the range(0->255).
- classmethod from_triplet(triplet)[source]
Create a truecolor RGB color from a triplet of values.
- Parameters:
triplet (ColorTriplet) – A color triplet containing red, green and blue components.
- Returns:
A new color object.
- Return type:
- get_truecolor(theme=None, foreground=True)[source]
Get an equivalent color triplet for this color.
- Parameters:
theme (TerminalTheme, optional) – Optional terminal theme, or None to use default. Defaults to None.
foreground (bool, optional) – True for a foreground color, or False for background. Defaults to True.
- Returns:
A color triplet containing RGB components.
- Return type:
ColorTriplet
- property system: ColorSystem
Get the native color system for this color.