quirl.theme

Theme system for Quirl components.

Provides design tokens (colors, spacing, typography, etc.) as CSS custom properties so any Quirl component can reference var(–theme-) instead of hardcoded literals. Tokens are open-ended — add any name/value pair, not just the built-in defaults.

Module Contents

Classes

Theme

An extensible set of design tokens.

API

class quirl.theme.Theme(name: str = 'default', base: Optional[quirl.theme.Theme] = None, **tokens: str)[source]

Bases: quirl.theme.Theme

An extensible set of design tokens.

Tokens live in a plain dict so new ones can be added at construction time or later via update() — useful for overrides, plugin tokens, or runtime values. Each token becomes –quirl- in CSS.

Access the globally active theme at the class level:

active = Theme.current
Theme.current = my_custom_theme

Initialization

Initialize a new theme with layered tokens.

Parameters:
  • name – Identifier for this theme.

  • base – Optional Theme to inherit from before applying defaults and explicit overrides.

  • **tokens – Any token name/value pairs. Unknown names are accepted, this is what makes the theme extensible.

CSS_PREFIX: ClassVar[str]

‘theme’

DEFAULTS: ClassVar[dict[str, str]]

None