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)
| 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">"" |