First product
This commit is contained in:
parent
778da9e2fc
commit
4433d7d2c4
157 changed files with 23975 additions and 0 deletions
24
app/theme.py
Normal file
24
app/theme.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Final
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ThemeDefinition:
|
||||
slug: str
|
||||
label: str
|
||||
|
||||
|
||||
THEMES: Final[tuple[ThemeDefinition, ...]] = (
|
||||
ThemeDefinition(slug="terracotta", label="Terracotta"),
|
||||
ThemeDefinition(slug="fjord", label="Fjord"),
|
||||
ThemeDefinition(slug="spruce", label="Spruce"),
|
||||
)
|
||||
_THEME_SLUGS: Final[frozenset[str]] = frozenset(theme.slug for theme in THEMES)
|
||||
DEFAULT_THEME: Final[str] = THEMES[0].slug
|
||||
|
||||
|
||||
def resolve_theme(candidate: str | None) -> str:
|
||||
if candidate and candidate in _THEME_SLUGS:
|
||||
return candidate
|
||||
return DEFAULT_THEME
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue