Theme Reference¶
Bases: Theme
A container for style information used by rich.console.Console.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
styles
|
Optional[dict[str, StyleType]]
|
Mapping of style names to styles, e.g.
|
None
|
Notes
The theme always inherits Rich's default styles (inherit=True).
Source code in src/rich_gradient/theme.py
theme
property
writable
¶
The rich.theme.Theme built from this instance's styles.
__call__()
¶
Return the theme, so the instance can be used as a theme factory.
Returns:
| Type | Description |
|---|---|
Theme
|
The |
__getitem__(name)
¶
Look up a style by name, e.g. theme["warning"].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The style name. |
required |
Returns:
| Type | Description |
|---|---|
Style
|
The parsed |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no style has that name. |
Source code in src/rich_gradient/theme.py
__init__(styles=None)
¶
Initialize the theme; see the class docstring for arguments.
Source code in src/rich_gradient/theme.py
__repr__()
¶
Return a developer-friendly representation.
Returns:
| Type | Description |
|---|---|
str
|
|
__rich__()
¶
Render the theme as a table of its styles.
Returns:
| Type | Description |
|---|---|
Table
|
The styles table from |
get_theme_table()
classmethod
¶
Get a table of all default styles.
Returns:
| Type | Description |
|---|---|
Table
|
The styles table from |
Note:
GRADIENT_TERMINAL_THEMEis a terminal theme constant exported from
rich_gradient.themefor use withConsole.save_svg. It is not included inthe auto-generated API table above but is part of the public API.