Module

rendering.highlighting.theme_resolver

Syntax theme resolution for Bengal's Rosettes integration.

This module handles the mapping from Bengal's site palettes to Rosettes syntax highlighting themes, implementing the "zero-config" experience where syntax themes auto-inherit from the site palette.

RFC-0003: Rosettes Theming Architecture

Usage:

>>> from bengal.rendering.highlighting.theme_resolver import resolve_syntax_theme
>>> palette_name = resolve_syntax_theme(config)
>>> # Returns: "bengal-snow-lynx" if site uses snow-lynx palette

Functions

resolve_syntax_theme 1 str
Resolve which syntax palette to use based on site configuration. This implemen…
def resolve_syntax_theme(config: dict[str, Any]) -> str

Resolve which syntax palette to use based on site configuration.

This implements the "auto" theme inheritance from RFC-0003:

  • If theme is "auto", inherit from default_palette
  • Otherwise, use the explicitly specified theme
Parameters
Name Type Description
config dict[str, Any]

Full site configuration dictionary.

Returns
str
resolve_css_class_style 1 CssClassStyle
Resolve which CSS class style to use for syntax highlighting.
def resolve_css_class_style(config: dict[str, Any]) -> CssClassStyle
Parameters
Name Type Description
config dict[str, Any]

Full site configuration dictionary.

Returns
CssClassStyle