bootstack.style.Theme#
- class bootstack.style.Theme(name, primary=None, success=None, info=None, warning=None, danger=None, secondary=None, neutral='#adb5bd', light=None, dark=None, surfaces=None, display_name=None, white='#ffffff', black='#000000')#
Bases:
objectA color theme family declared in code.
Declare the semantic accent colors as
[500]anchors plus alightand/ordarkblock (background/foreground). Each accent generates a 50–950 ramp; the framework picks the per-mode step for solids, washes, borders, and emphasis text.install()registers the generated<name>-lightand<name>-darkvariants.- Parameters:
name (str) – Family name; generated variants are
<name>-light/<name>-dark.primary (str | None) – Primary accent color (the
[500]ramp midpoint), as hex.success (str | None) – Success accent color (hex).
info (str | None) – Info accent color (hex).
warning (str | None) – Warning accent color (hex).
danger (str | None) – Danger accent color (hex).
secondary (str | None) – Optional colored secondary accent (hex). When omitted,
secondaryderives from the neutral ramp.neutral (str) – Gray base for the neutral ramp (borders, muted text, secondary).
light (dict[str, str] | None) –
{'background': ..., 'foreground': ...}for the light variant, or None to skip it.dark (dict[str, str] | None) –
{'background': ..., 'foreground': ...}for the dark variant.surfaces (dict | None) – Optional surface overrides — either a flat
{'chrome': '#...'}(both modes) or per-mode{'light': {...}, 'dark': {...}}. Pins surfaces the auto-derivation can’t produce well (e.g. chrome on a very-dark background).display_name (str | None) – Human label base; the mode is appended (` Light`/` Dark`).
white (str) – Reference white. Defaults to
'#ffffff'.black (str) – Reference black. Defaults to
'#000000'.
- install(*, activate=False)#
Register the generated variants so they can be activated by name.
- variants()#
Return the generated per-mode schema dicts (light first, then dark).