rich.theme

class rich.theme.Theme(styles=None, inherit=True)[源代码]

用于样式信息的容器,由 Console

参数
  • styles (Dict[str, Style], optional) -- 样式名称到样式的映射。对于没有样式的主题,默认为无。

  • inherit (bool, optional) -- 继承默认样式。默认为True。

property config: str

获取此主题的配置文件的内容。

classmethod from_file(config_file, source=None, inherit=True)[源代码]

从文本模式文件加载主题。

参数
  • config_file (IO[str]) -- 打开的会议文件。

  • source (str, optional) -- 打开的文件的文件名。默认为无。

  • inherit (bool, optional) -- 继承默认样式。默认为True。

返回

一个新的主题实例。

返回类型

Theme

classmethod read(path, inherit=True, encoding=None)[源代码]

从一条小路上读一个主题。

参数
  • path (str) -- Python配置解析器模块可读的配置文件的路径。

  • inherit (bool, optional) -- 继承默认样式。默认为True。

  • encoding (str, optional) -- 配置文件的编码。默认为无。

返回

一个新的主题实例。

返回类型

Theme