MCPcopy
hub / github.com/Textualize/rich / push_theme

Method push_theme

rich/theme.py:92–104  ·  rich/theme.py::ThemeStack.push_theme

Push a theme on the top of the stack. Args: theme (Theme): A Theme instance. inherit (boolean, optional): Inherit styles from current top of stack.

(self, theme: Theme, inherit: bool = True)

Source from the content-addressed store, hash-verified

90 self.get = self._entries[-1].get
91
92 def push_theme(self, theme: Theme, inherit: bool = True) -> None:
93 class="st">"""Push a theme on the top of the stack.
94
95 Args:
96 theme (Theme): A Theme instance.
97 inherit (boolean, optional): Inherit styles from current top of stack.
98 class="st">"""
99 styles: Dict[str, Style]
100 styles = (
101 {**self._entries[-1], **theme.styles} if inherit else theme.styles.copy()
102 )
103 self._entries.append(styles)
104 self.get = self._entries[-1].get
105
106 def pop_theme(self) -> None:
107 class="st">""class="st">"Pop (and discard) the top-most theme."class="st">""

Callers 1

test_theme_stackFunction · 0.95

Calls 2

copyMethod · 0.45
appendMethod · 0.45

Tested by 1

test_theme_stackFunction · 0.76