rich.theme¶
-
class
rich.theme.
Theme
(styles: Optional[Mapping[str, Union[str, rich.style.Style]]] = None, inherit: bool = True)[source]¶ A container for style information, used by
Console
.- Parameters
styles (Dict[str, Style], optional) – A mapping of style names on to styles. Defaults to None for a theme with no styles.
inherit (bool, optional) – Inherit default styles. Defaults to True.
-
property
config
¶ Get contents of a config file for this theme.
-
classmethod
from_file
(config_file: IO[str], source: Optional[str] = None, inherit: bool = True) → rich.theme.Theme[source]¶ Load a theme from a text mode file.
- Parameters
config_file (IO[str]) – An open conf file.
source (str, optional) – The filename of the open file. Defaults to None.
inherit (bool, optional) – Inherit default styles. Defaults to True.
- Returns
A New theme instance.
- Return type
-
classmethod
read
(path: str, inherit: bool = True) → rich.theme.Theme[source]¶ Read a theme from a path.
- Parameters
path (str) – Path to a config file readable by Python configparser module.
inherit (bool, optional) – Inherit default styles. Defaults to True.
- Returns
A new theme instance.
- Return type