Module

themes.tokens

Shared design tokens for Bengal's web and terminal themes.

This module is the single source of truth for all visual design tokens used across Bengal's web CSS output and Textual terminal interfaces. All color values meet WCAG AA contrast requirements.

Token Categories:

Color Palettes: Brand, semantic, surface, border, and text colors Mascots: ASCII art characters and status icons for terminal output Palette Variants: Named color schemes (default, blue-bengal, etc.)

Dataclasses:

BengalPalette: Complete color palette with all token categories BengalMascots: Terminal mascots and status/navigation icons PaletteVariant: Subset of colors for theme variants

Protocols:

ColorPalette: Common interface for all palette types (BengalPalette, PaletteVariant)

Instances:

BENGAL_PALETTE: Default palette instance for direct access BENGAL_MASCOT: Default mascots instance for terminal output PALETTE_VARIANTS: Dict mapping variant names to PaletteVariant instances

Example:

>>> from bengal.themes.tokens import BENGAL_PALETTE, BENGAL_MASCOT
>>> print(BENGAL_PALETTE.primary)

#FF9D00 >>> print(BENGAL_MASCOT.cat) ᓚᘏᗢ

Architecture:

Tokens are defined as frozen dataclasses for immutability and hashability. The generate.py module reads these tokens to produce CSS output files.

Related:

bengal/themes/generate.py: CSS/TCSS generation from these tokens bengal/cli/dashboard/bengal.tcss: Textual dashboard styles bengal/themes/default/assets/css/tokens/: Generated web CSS

Classes

ColorPalette 12
Protocol defining the common interface for color palettes. Both BengalPalette (full palette) and P…

Protocol defining the common interface for color palettes.

Both BengalPalette (full palette) and PaletteVariant (subset) implement this interface, ensuring type safety when using get_palette().

This protocol guarantees that callers can access these core color attributes regardless of which palette type is returned:

Attributes

Name Type Description
primary

Primary brand color

accent

Accent/highlight color

success

Success state color

error

Error state color

surface

Widget surface color

background

Base background color

Methods

primary 0 str
property
def primary(self) -> str
Returns
str
accent 0 str
property
def accent(self) -> str
Returns
str
success 0 str
property
def success(self) -> str
Returns
str
error 0 str
property
def error(self) -> str
Returns
str
surface 0 str
property
def surface(self) -> str
Returns
str
background 0 str
property
def background(self) -> str
Returns
str
BengalPalette 17
Bengal color palette with semantic color tokens. All colors meet WCAG AA contrast ratio (4.5:1) ag…

Bengal color palette with semantic color tokens.

All colors meet WCAG AA contrast ratio (4.5:1) against both dark (#1a1a1a) and light (#fafafa) backgrounds for accessibility compliance.

Attributes

Name Type Description
primary str

Bengal signature vivid orange (#FF9D00)

secondary str

Complementary bright blue (#3498DB)

accent str

Highlight sunflower yellow (#F1C40F)

success str

Positive state emerald green (#2ECC71)

warning str

Caution state carrot orange (#E67E22)

error str

Error state alizarin crimson (#E74C3C)

info str

Informational silver (#95A5A6)

muted str

De-emphasized grayish (#7F8C8D)

surface str

Dark widget surface (#1e1e1e)

surface_light str

Elevated surface (#2d2d2d)

background str

Base dark background (#121212)

foreground str

Primary light text (#e0e0e0)

border str

Subtle border color (#3a3a3a)

border_focus str

Focus ring using primary (#FF9D00)

text_primary str

Main text color (#e0e0e0)

text_secondary str

Secondary text (#9e9e9e)

text_muted str

De-emphasized text (#757575)

BengalMascots 17
Bengal brand mascots and status icons for terminal output. Provides ASCII-compatible characters fo…

Bengal brand mascots and status icons for terminal output.

Provides ASCII-compatible characters for terminal UI elements including the Bengal cat mascot, status indicators, navigation symbols, and performance grades. All characters render across modern terminals.

Attributes

Name Type Description
cat str

Bengal cat mascot for success/help headers (ᓚᘏᗢ)

mouse str

Mouse for error headers - cat catches bugs (ᘛ⁐̤ᕐᐷ)

rosettes str

Rosettes syntax highlighter logo - spots pattern (⌾⌾⌾)

kida str

Kida template engine logo - face + whiskers ()彡)

success str

Checkmark for success status (✓)

warning str

Exclamation for warnings (!)

error str

X mark for errors (x)

info str

Dash for informational messages (-)

tip str

Asterisk for tips (*)

pending str

Middle dot for pending state (·)

arrow str

Right arrow for navigation (→)

tree_branch str

Tree branch for hierarchy (├─)

tree_end str

Tree end for last item (└─)

grade_excellent str

Excellent performance (++)

grade_fast str

Fast performance (+)

grade_moderate str

Moderate performance (~)

grade_slow str

Slow performance (-)

PaletteVariant 7
Named color palette variant for theming. Provides a subset of color tokens that define a cohesive …

Named color palette variant for theming.

Provides a subset of color tokens that define a cohesive visual theme. Variants can be applied via the BENGAL_PALETTE environment variable or theme configuration.

Attributes

Name Type Description
name str

Variant identifier (e.g., "blue-bengal", "charcoal-bengal")

primary str

Primary brand color for the variant

accent str

Accent/highlight color

success str

Success state color

error str

Error state color

surface str

Widget surface color (default: #1e1e1e)

background str

Base background color (default: #121212)

Functions

get_palette 1 ColorPalette
Get a color palette by name. Retrieves either the default BengalPalette or a n…
def get_palette(name: str = 'default') -> ColorPalette

Get a color palette by name.

Retrieves either the default BengalPalette or a named PaletteVariant. Falls back to the default palette if the requested name is not found.

The returned palette implements the ColorPalette protocol, guaranteeing access to: primary, accent, success, error, surface, background.

Parameters
Name Type Description
name str

Palette variant name. Use "default" for the full BengalPalette, or a variant name like "blue-bengal", "charcoal-bengal", etc.

Default:'default'
Returns
ColorPalette