# cocopon/vscode-iceberg-theme architecture

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

- Interactive diagram: https://gitdiagram.com/cocopon/vscode-iceberg-theme
- Repository: https://github.com/cocopon/vscode-iceberg-theme

## Overview

##### File structure
- Top-level:
- package.json, tsconfig.json, build/config files → Node.js/TypeScript project
- src/ → all TypeScript source
- themes/ → generated output JSONs
- Under src/:
- main.ts → CLI entry point
- themes/ ↔ templates or intermediate definitions for VS Code
- vim-palettes/ ↔ original Vim palette definitions
- Build artifacts are produced by running `npm run build`, which compiles `src/**/*.ts` → JavaScript and then writes JSON under `themes/`.

##### README for additional insights
- Key dependencies: Node.js runtime (fs, path), TypeScript compiler.

a. Main components
1. CLI Controller (main.ts)
3. Palette Data Sources (src/vim-palettes, src/themes/index.ts)
4. Output Generator (writes JSON files to themes/)
5. Node.js Runtime / File System
b. Relationships & data flow
- User runs `npm run build` → invokes CLI Controller
- Output Generator serializes theme objects → writes .json files to `themes/`
c. Architectural patterns & design principles
- Typed layer (TypeScript interfaces guarantee theme schema correctness)
- Template-driven generation (data + engine → output)
d. Key technologies & libraries
- Node.js (fs, path modules)
- TypeScript (src/**/*.ts, tsconfig.json)
- ESLint & Prettier (src/.eslintrc.js, .prettierrc.js)
- NPM scripts (build, test, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Runtime
    NodeRuntime["Node.js Runtime / File System"]:::external

    %% Build Configuration
    subgraph "Build Configuration"
        TSConfig["tsconfig.json"]:::config
        ESLint[".eslintrc.js"]:::config
        Prettier[".prettierrc.js"]:::config
        PackageJSON["package.json"]:::config
    end

    %% Data Sources
    subgraph "Palette Data Sources"
        subgraph "Vim Palettes" 
            VimIndex["index.ts"]:::data
            VimDark["dark.ts"]:::data
            VimLight["light.ts"]:::data
        end
        subgraph "VSCode Templates"
            VscodeIndex["index.ts"]:::data
            VscodeDark["dark.ts"]:::data
            VscodeLight["light.ts"]:::data
        end
    end

    %% Processing Logic
    subgraph "Processing Logic"
        CLI["CLI Controller\n(main.ts)"]:::process
        ColorEngine["Color Engine\n(color.ts)"]:::process
        subgraph "TypeScript Types"
            TypePalette["palette.ts"]:::process
            TypeVim["vim-paeltte.ts"]:::process
            TypeVscodePalette["vscode-palette.ts"]:::process
            TypeVscodeTheme["vscode-theme.ts"]:::process
        end
    end

    %% Output
    subgraph "Output Generation"
        JSONWriter["Output Generator\n(JSON Writer)"]:::io
        subgraph "Generated Themes"
            ThemeDark["iceberg.color-theme.json"]:::io
            ThemeLight["iceberg-light.color-theme.json"]:::io
        end
    end

    %% Connections
    NodeRuntime -->|"run CLI"| CLI
    CLI -->|"loads Vim Palettes"| VimIndex
    VimIndex --> VimDark
    VimIndex --> VimLight
    CLI -->|"loads VSCode Templates"| VscodeIndex
    VscodeIndex --> VscodeDark
    VscodeIndex --> VscodeLight
    CLI -->|"passes data to"| ColorEngine
    ColorEngine -->|"uses types"| TypePalette
    ColorEngine --> TypeVim
    ColorEngine --> TypeVscodePalette
    ColorEngine --> TypeVscodeTheme
    ColorEngine -->|"returns theme objects"| JSONWriter
    JSONWriter -->|"writes files"| ThemeDark
    JSONWriter --> ThemeLight
    JSONWriter -->|"to"| NodeRuntime
    TSConfig --- CLI
    ESLint --- CLI
    Prettier --- CLI
    PackageJSON --- CLI

    %% Click Events
    click CLI "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/main.ts"
    click ColorEngine "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/color.ts"
    click VscodeIndex "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/themes/index.ts"
    click VscodeDark "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/themes/dark.ts"
    click VscodeLight "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/themes/light.ts"
    click VimIndex "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/vim-palettes/index.ts"
    click VimDark "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/vim-palettes/dark.ts"
    click VimLight "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/vim-palettes/light.ts"
    click TypePalette "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/types/palette.ts"
    click TypeVim "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/types/vim-paeltte.ts"
    click TypeVscodePalette "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/types/vscode-palette.ts"
    click TypeVscodeTheme "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/types/vscode-theme.ts"
    click ThemeDark "https://github.com/cocopon/vscode-iceberg-theme/blob/main/themes/iceberg.color-theme.json"
    click ThemeLight "https://github.com/cocopon/vscode-iceberg-theme/blob/main/themes/iceberg-light.color-theme.json"
    click TSConfig "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/tsconfig.json"
    click ESLint "https://github.com/cocopon/vscode-iceberg-theme/blob/main/src/.eslintrc.js"
    click Prettier "https://github.com/cocopon/vscode-iceberg-theme/blob/main/.prettierrc.js"
    click PackageJSON "https://github.com/cocopon/vscode-iceberg-theme/blob/main/package.json"

    %% Styles
    classDef data fill:#aed6f1,stroke:#21618c,color:#1b2631
    classDef process fill:#a9dfbf,stroke:#196f3d,color:#1b2631
    classDef io fill:#fad7a0,stroke:#b9770e,color:#1b2631
    classDef external fill:#d5dbdb,stroke:#566573,color:#1b2631
    classDef config fill:#e8daef,stroke:#6c3483,color:#1b2631
```
