# sohzm/shvet architecture

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

- Interactive diagram: https://gitdiagram.com/sohzm/shvet
- Repository: https://github.com/sohzm/shvet

## Overview

##### Project type and purpose
- This is a command-line application written in Go.
- Purpose: apply HSV-based “themes” (e.g., dracula, gruvbox, nord, etc.) to images. Users invoke `shvet <theme> path/to/image.png` (optionally with a `force` flag) to produce a recolored output image.

##### File structure
- Top-level entry point:
- main.go / main_test.go
- Core packages & responsibilities:
- arguments/ — parse CLI flags and positional arguments
- handlers/ — dispatch commands (`list`, `help`, theme application, force mode)
- data/ — embed HSV presets for each theme (dracula.go, gruvbox.go, etc.)
- files/ — load and save image files (PNG, JPEG, etc.)
- converters/ — apply HSV conversion logic to pixel data
- assets/ — static files (SVG banner, docs)
- go.mod / go.sum — dependency management

##### README for additional insights
- Confirms this is a CLI tool focused on output quality, not yet performance
- Themes are easily extensible by adding a new Go file in data/
- No external servers or services—entire processing is local

a. Main components
1. CLI Interface (User / Terminal)
2. Argument Parser (arguments/)
3. Command Dispatcher / Handler (handlers/)
4. Theme Data Store (data/)
5. File I/O Module (files/)
6. Conversion Engine (converters/)
7. Math Operations Library (operations/)
8. Shared Data Models (structs/)
9. OS File System & Go Runtime

b. Relationships and data flow
- User types `shvet <mode> <theme> <image-path>` → CLI Interface
→ Argument Parser → Handler
→ if `list`/`help`, output text and exit
→ otherwise, Handler loads theme from Theme Data Store
→ Handler calls File I/O Module to read image into memory
→ Image buffer + theme HSV map → Conversion Engine
→ Conversion Engine invokes Operations library for pixel-by-pixel math
→ Resulting buffer → File I/O Module writes new image
→ Handler returns success/exit code

c. Architectural patterns / design principles
- Modular, package-based separation of concerns
- Single executable binary (no microservices)
- Data-driven theme extension (drop-in Go source)
- Pipeline style: sequential processing stages

d. Key technologies, frameworks, libraries
- Go standard library (`flag`, `image`, `image/png`, etc.)
- Go modules (go.mod)
- Custom logic in converters/ and operations/

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    subgraph "User Interaction"
        CLI["CLI Interface\n(main.go)"]:::io
        CLI --> Parser
    end

    %% Parsing and Dispatch
    Parser["Argument Parser\n(arguments/)"]:::util
    Parser --> Handler

    Handler["Command Dispatcher\n(handlers/)"]:::util
    Handler -->|loads theme| DataStore
    Handler -->|reads/writes image| FileIO
    Handler -->|returns exit code| CLI

    %% Data and I/O
    DataStore["Theme Data Store\n(data/)"]:::data
    FileIO["File I/O Module\n(files/files.go)"]:::io

    DataStore --> Converter
    FileIO --> Converter

    %% Processing Pipeline
    Converter["Conversion Engine\n(converters/)"]:::process
    Converter --> Operations
    Operations["Math Operations Library\n(operations/)"]:::process
    Operations --> Converter

    Converter --> FileIO
    FileIO --> Platform

    %% Shared Models
    Structs["Shared Data Models\n(structs/structs.go)"]:::util
    Parser --> Structs
    Handler --> Structs
    Converter --> Structs
    Operations --> Structs
    FileIO --> Structs

    %% Supporting Components
    Assets["Assets\n(assets/)"]:::data
    goMod["Go Modules\n(go.mod & go.sum)"]:::util
    Tests["Tests\n(main_test.go)"]:::util

    %% Platform
    Platform["Go Runtime & OS File System"]:::platform

    %% Click Events
    click CLI "https://github.com/sohzm/shvet/blob/main/main.go"
    click Parser "https://github.com/sohzm/shvet/blob/main/arguments/arguments.go"
    click Parser "https://github.com/sohzm/shvet/blob/main/arguments/helpers.go"
    click Handler "https://github.com/sohzm/shvet/blob/main/handlers/handlers.go"
    click Handler "https://github.com/sohzm/shvet/blob/main/handlers/helpers.go"
    click DataStore "https://github.com/sohzm/shvet/tree/main/data/"
    click FileIO "https://github.com/sohzm/shvet/blob/main/files/files.go"
    click Converter "https://github.com/sohzm/shvet/blob/main/converters/converters.go"
    click Operations "https://github.com/sohzm/shvet/blob/main/operations/operations.go"
    click Operations "https://github.com/sohzm/shvet/blob/main/operations/helpers.go"
    click Structs "https://github.com/sohzm/shvet/blob/main/structs/structs.go"
    click Assets "https://github.com/sohzm/shvet/tree/main/assets/"
    click goMod "https://github.com/sohzm/shvet/blob/main/go.mod"
    click goMod "https://github.com/sohzm/shvet/blob/main/go.sum"
    click Tests "https://github.com/sohzm/shvet/blob/main/main_test.go"

    %% Styles
    classDef io fill:#D6E8FF,stroke:#0041C2,color:#0041C2;
    classDef process fill:#E2FFD6,stroke:#1B7A00,color:#1B7A00;
    classDef data fill:#FFF2CC,stroke:#7A6A00,color:#7A6A00;
    classDef util fill:#F0F0F0,stroke:#666666,color:#333333;
    classDef platform fill:#E8E8E8,stroke:#AAAAAA,color:#555555;
```
