Module

themes.config

Theme configuration models and YAML loader.

Provides ThemeConfig dataclass with nested configuration models for features, appearance, and icons. Supports loading from theme.yaml files with validation.

Classes

FeatureFlags dataclass
Feature flags configuration. Features are organized by category (navigation, content, etc.) and ca…
3

Feature flags configuration.

Features are organized by category (navigation, content, etc.) and can be enabled/disabled individually. Each feature can have a description for documentation purposes.

Attributes

Name Type Description
navigation dict[str, bool]
content dict[str, bool]
search dict[str, bool]
header dict[str, bool]
footer dict[str, bool]
accessibility dict[str, bool]

Methods 3

get_enabled_features
Get list of all enabled feature keys in dotted notation.
0 list[str]
def get_enabled_features(self) -> list[str]

Get list of all enabled feature keys in dotted notation.

Returns

list[str]

List of feature keys like ["navigation.toc", "content.code.copy"]

has_feature
Check if a feature is enabled.
1 bool
def has_feature(self, feature: str) -> bool

Check if a feature is enabled.

Parameters 1
feature str

Feature key in dotted notation (e.g., "navigation.toc")

Returns

bool

True if feature is enabled

from_dict classmethod
Create FeatureFlags from dictionary.
1 FeatureFlags
def from_dict(cls, data: dict[str, Any]) -> FeatureFlags

Create FeatureFlags from dictionary.

Parameters 1
data dict[str, Any]

Dictionary with feature flags organized by category

Returns

FeatureFlags

FeatureFlags instance

AppearanceConfig dataclass
Appearance configuration (theme mode and palette). Controls default appearance mode (light/dark/sy…
2

Appearance configuration (theme mode and palette).

Controls default appearance mode (light/dark/system) and color palette.

Attributes

Name Type Description
default_mode str
default_palette str

Methods 1

from_dict classmethod
Create AppearanceConfig from dictionary.
1 AppearanceConfig
def from_dict(cls, data: dict[str, Any]) -> AppearanceConfig

Create AppearanceConfig from dictionary.

Parameters 1
data dict[str, Any]

Dictionary with appearance settings

Returns

AppearanceConfig

AppearanceConfig instance

Internal Methods 1
__post_init__
Validate appearance configuration.
0 None
def __post_init__(self) -> None

Validate appearance configuration.

IconConfig dataclass
Icon configuration (library and aliases). Controls which icon library is used and provides semanti…
2

Icon configuration (library and aliases).

Controls which icon library is used and provides semantic name aliases for icon names (e.g., "search" -> "magnifying-glass").

Attributes

Name Type Description
library str
aliases dict[str, str]
defaults dict[str, str]

Methods 2

from_dict classmethod
Create IconConfig from dictionary.
1 IconConfig
def from_dict(cls, data: dict[str, Any]) -> IconConfig

Create IconConfig from dictionary.

Parameters 1
data dict[str, Any]

Dictionary with icon settings

Returns

IconConfig

IconConfig instance

to_dict
Convert IconConfig to dictionary.
0 dict[str, Any]
def to_dict(self) -> dict[str, Any]

Convert IconConfig to dictionary.

Returns

dict[str, Any]

Dictionary representation

ThemeConfig dataclass
Complete theme configuration loaded from theme.yaml. Consolidates all theme settings (features, ap…
2

Complete theme configuration loaded from theme.yaml.

Consolidates all theme settings (features, appearance, icons) into a single configuration object that can be loaded from YAML.

Attributes

Name Type Description
name str
version str
parent str | None
features FeatureFlags
appearance AppearanceConfig
icons IconConfig

Methods 2

load classmethod
Load theme configuration from theme.yaml file.
1 ThemeConfig
def load(cls, theme_path: Path) -> ThemeConfig

Load theme configuration from theme.yaml file.

Parameters 1
theme_path Path

Path to theme directory (will look for theme.yaml)

Returns

ThemeConfig

ThemeConfig instance loaded from YAML

to_dict
Convert ThemeConfig to dictionary for serialization.
0 dict[str, Any]
def to_dict(self) -> dict[str, Any]

Convert ThemeConfig to dictionary for serialization.

Returns

dict[str, Any]

Dictionary representation suitable for YAML export