# warpdotdev/themes architecture

> Architecture diagram of the GitHub repository warpdotdev/themes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/warpdotdev/themes
- Repository: https://github.com/warpdotdev/themes

## Overview

##### Project type and purpose
- It organizes hundreds of `.yaml` theme definitions into logical feature sets (Base16, standard, holiday/special, bundled, etc.) and provides a Python script to auto-generate preview images.

##### File structure
- Top‐level directories:
- base16/, standard/, special_edition/, warp_bundled/, stradicat/ – each holds a set of `.yaml` theme files plus its own previews/ subfolder.
- scripts/ – contains `gen_theme_previews.py` and its `requirements.txt`.
- Configuration & tooling:
- .github/ – pull-request template.
- .warp/workflows/ – GitHub Actions workflow to run the theme generator.
- .trunk/ – trunk CLI config for versioning/release.
- Every theme directory follows the same pattern: `[some_theme].yaml` definitions → previews/ where generated PNGs land.

##### README for additional insights
- Describes the use of `gen_theme_previews.py` to generate preview images on contribution.
- Describes how Warp loads YAML theme files at runtime.
- Mentions external dependencies: PyYAML, GitHub Actions, Warp CLI.
- Calls out upstream theme sources (e.g., base16, Alacritty-theme).

##### Detail
- Directory as its own module, even if structurally identical, to underscore maintainability and separation of concerns.
- How configuration files (`.warp/workflows`, `.trunk/trunk.yaml`) drive automated processes.
- Don’t omit the user‐consumption flow—this is how themes reach real‐world usage in the Warp app.
- Optional background‐image feature in the YAML parsing block.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and Contributors
    subgraph "Users & Contributors" 
        direction TB
        UC1("Contributors"):::user
        UC2("End Users"):::user
    end

    %% Content Directories
    subgraph "Theme Definition Modules" 
        direction TB
        B16["Base16 Themes"]:::content
        STD["Standard Themes"]:::content
        SPED["Special Edition Themes"]:::content
        WB["Warp-Bundled Themes"]:::content
        STRAD["Stradicat Themes"]:::content
    end

    %% Processing
    subgraph "Processing" 
        direction TB
        GEN["Preview Generator Script"]:::script
        REQ["Python Dependencies"]:::script
    end

    %% CI/CD and Versioning
    subgraph "CI/CD & Release" 
        direction TB
        PRT["Pull-Request Template"]:::config
        CI["GitHub Actions Workflow"]:::ci
        VER["Versioning Configuration"]:::config
    end

    %% External Dependencies
    subgraph "External Dependencies & Sources"
        direction TB
        PYY["PyYAML"]:::external
        UPSTREAM["Upstream Theme Sources"]:::external
        WCLI["Warp CLI"]:::external
    end

    %% Consume Flow
    subgraph "Usage Flow"
        direction TB
        CLONE["Repo Clone"]:::external
        LOAD["Warp CLI Loads YAML"]:::external
        TERM["Terminal UI"]:::external
    end

    %% Relationships
    UC1 -->|creates PR| PRT
    PRT -->|triggers| CI
    CI -->|runs| GEN
    CI -->|uses| VER
    CI -->|checks| REQ
    GEN -->|reads YAML| B16
    GEN -->|reads YAML| STD
    GEN -->|reads YAML| SPED
    GEN -->|reads YAML| WB
    GEN -->|reads YAML| STRAD
    GEN -->|generates PNGs in previews/| B16
    GEN -->|generates PNGs in previews/| STD
    GEN -->|generates PNGs in previews/| SPED
    GEN -->|generates PNGs in previews/| WB
    GEN -->|generates PNGs in previews/| STRAD
    GEN -->|imports| PYY
    UC2 -->|installs/clones repo| CLONE
    CLONE -->|selects theme YAML| LOAD
    LOAD -->|applies colors| TERM
    LOAD -->|calls| WCLI
    GEN -->|optional background images| UPSTREAM

    %% Click events
    click B16 "https://github.com/warpdotdev/themes/tree/main/base16/"
    click STD "https://github.com/warpdotdev/themes/tree/main/standard/"
    click SPED "https://github.com/warpdotdev/themes/tree/main/special_edition/"
    click WB "https://github.com/warpdotdev/themes/tree/main/warp_bundled/"
    click STRAD "https://github.com/warpdotdev/themes/tree/main/stradicat/"
    click GEN "https://github.com/warpdotdev/themes/blob/main/scripts/gen_theme_previews.py"
    click REQ "https://github.com/warpdotdev/themes/blob/main/scripts/requirements.txt"
    click CI "https://github.com/warpdotdev/themes/blob/main/.warp/workflows/run_themes_generator.yml"
    click VER "https://github.com/warpdotdev/themes/blob/main/.trunk/trunk.yaml"
    click PRT "https://github.com/warpdotdev/themes/blob/main/.github/PULL_REQUEST_TEMPLATE.md"

    %% Styles
    classDef user fill:#FDE68A,stroke:#F59E0B,color:#92400E
    classDef content fill:#BFDBFE,stroke:#3B82F6,color:#1E3A8A
    classDef script fill:#DCFCE7,stroke:#22C55E,color:#164E63
    classDef ci fill:#FED7AA,stroke:#FB923C,color:#7C2D12
    classDef config fill:#E9D5FF,stroke:#A78BFA,color:#4C1D95
    classDef external fill:#E5E7EB,stroke:#9CA3AF,color:#374151
```
