← Files ClaraARCHIVED FILE

vendor/modules/courseware/theme.py

784 Bytes · Nov 14, 2026 · 00:33 UTC

↓ Download file

See the change to this file →

"""Apply the shared workflow appearance to lesson shells without restyling reports."""

from __future__ import annotations

from pathlib import Path

__all__ = ["theme_lesson"]


def theme_lesson(page: str, product: str, root: Path, destination: Path) -> str:
    """Copy the offline stylesheet and link it only from Clara/Lucia lessons."""
    if product not in {"clara", "lucia"}:
        return page
    source = root / "ui/theme.css"
    if not source.is_file():
        source = Path(__file__).resolve().parents[3] / "ui/vera-theme.css"
    if not source.is_file():
        return page
    (destination / "workflow-theme.css").write_bytes(source.read_bytes())
    link = '<link rel="stylesheet" href="workflow-theme.css">'
    return page.replace("</head>", link + "</head>", 1)

SHA-256: 26501b56d6e6f99573a40343de95221671758db13d23a14a7012590a89ae2631