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: object

A color theme family declared in code.

Declare the semantic accent colors as [500] anchors plus a light and/or dark block (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>-light and <name>-dark variants.

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, secondary derives 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'.

black: str = '#000000'#
danger: str | None = None#
dark: dict[str, str] | None = None#
display_name: str | None = None#
info: str | None = None#
light: dict[str, str] | None = None#
name: str#
neutral: str = '#adb5bd'#
primary: str | None = None#
secondary: str | None = None#
success: str | None = None#
surfaces: dict | None = None#
warning: str | None = None#
white: str = '#ffffff'#
install(*, activate=False)#

Register the generated variants so they can be activated by name.

Parameters:

activate (bool | str) – True activates the light variant; pass a variant name (e.g. 'bootstrap-dark') to activate that one.

Returns:

This theme, to allow theme = Theme(...).install().

Return type:

Theme

variants()#

Return the generated per-mode schema dicts (light first, then dark).