Return a palette by name with graceful fallback. ``auto`` runs :func:`resolve_auto_theme` to pick between ``dark`` and ``light`` at boot. Unknown names fall back to ``dark``.
(name: str | None, *, env: dict[str, str] | None = None)
| 191 | |
| 192 | |
| 193 | def get_palette(name: str | None, *, env: dict[str, str] | None = None) -> Palette: |
| 194 | """Return a palette by name with graceful fallback. |
| 195 | |
| 196 | ``auto`` runs :func:`resolve_auto_theme` to pick between ``dark`` |
| 197 | and ``light`` at boot. Unknown names fall back to ``dark``. |
| 198 | """ |
| 199 | |
| 200 | if not name: |
| 201 | return DARK |
| 202 | key = name.strip().lower() |
| 203 | if key == "auto": |
| 204 | return _PALETTES.get(resolve_auto_theme(env=env), DARK) |
| 205 | return _PALETTES.get(key, DARK) |
| 206 | |
| 207 | |
| 208 | def textual_css_overrides(palette: Palette) -> str: |