# avgerinos8/blockshade-pixel-art architecture

> Architecture diagram of the GitHub repository avgerinos8/blockshade-pixel-art, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avgerinos8/blockshade-pixel-art
- Repository: https://github.com/avgerinos8/blockshade-pixel-art

## Overview

BlockShade is a terminal pixel-art editor. The user launches the Bubble Tea program, edits a character-grid canvas through keyboard and mouse controls, and sees the canvas rendered in the terminal; clipboard actions can move artwork in or out. The sampled source is a partial excerpt of a single-file implementation, so the graph keeps components at the responsibility level supported by the README and excerpt. Some feature links are omitted where the relevant wiring was not shown.

Main entry points: [`main.go`](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go) (Sidebar actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Editor interaction"]
  node_entry["Program entry<br/>[main.go]"]
  node_update["Input dispatcher<br/>[main.go]"]
  node_mouse["Mouse handling<br/>[main.go]"]
  node_sidebar["Sidebar actions<br/>[main.go]"]
end

subgraph group_canvas["Canvas editing"]
  node_brush["Brush sets<br/>[main.go]"]
  node_canvasops["Canvas operations<br/>[main.go]"]
  node_replace["Pattern replacement<br/>[main.go]"]
  node_history["Undo and redo<br/>[main.go]"]
end

subgraph group_display["Display and exchange"]
  node_clipboard["Clipboard actions<br/>[main.go]"]
  node_view["Terminal rendering<br/>[main.go]"]
  node_zoom["Zoom rendering<br/>[main.go]"]
end

node_user(("Editor user"))
node_terminal(("Terminal"))
node_bubbletea["Bubble Tea runtime"]
node_clipservice["System clipboard"]

node_user -->|"edits in"| node_terminal
node_terminal -->|"sends input"| node_bubbletea
node_entry -->|"starts program"| node_bubbletea
node_bubbletea -->|"dispatches events"| node_update
node_bubbletea -->|"requests view"| node_view
node_update -->|"routes mouse"| node_mouse
node_update -->|"routes actions"| node_sidebar
node_update -->|"handles shortcuts"| node_history
node_mouse -->|"paints canvas"| node_canvasops
node_mouse -->|"selects controls"| node_sidebar
node_sidebar -->|"selects brush"| node_brush
node_sidebar -->|"resizes canvas"| node_canvasops
node_sidebar -->|"configures replacement"| node_replace
node_sidebar -->|"requests copy or paste"| node_clipboard
node_canvasops -->|"saves state"| node_history
node_replace -->|"saves state"| node_history
node_history -->|"restores canvas"| node_canvasops
node_clipboard -->|"reads or writes"| node_clipservice
node_view -->|"reads selection"| node_brush
node_view -->|"renders scaled canvas"| node_zoom
node_view -->|"displays editor"| node_terminal
node_user -->|"views result"| node_view

click node_entry "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_update "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_mouse "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_sidebar "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_brush "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_canvasops "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_replace "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_history "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_clipboard "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_view "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"
click node_zoom "https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_update,node_mouse,node_sidebar,node_user toneBlue
class node_brush,node_canvasops,node_replace,node_history toneAmber
class node_clipboard,node_view,node_zoom toneMint
class node_terminal,node_bubbletea,node_clipservice toneIndigo
```

## Components

### Editor interaction

- [Program entry](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Input dispatcher](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Mouse handling](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Sidebar actions](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`

### Canvas editing

- [Brush sets](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Canvas operations](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Pattern replacement](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Undo and redo](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`

### Display and exchange

- [Clipboard actions](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Terminal rendering](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`
- [Zoom rendering](https://github.com/avgerinos8/blockshade-pixel-art/blob/main/main.go): `main.go`

### Other components

- **Editor user**
- **Terminal**
- **Bubble Tea runtime**
- **System clipboard**

## Connections

- Editor user → Terminal: edits in
- Terminal → Bubble Tea runtime: sends input
- Program entry → Bubble Tea runtime: starts program
- Bubble Tea runtime → Input dispatcher: dispatches events
- Bubble Tea runtime → Terminal rendering: requests view
- Input dispatcher → Mouse handling: routes mouse
- Input dispatcher → Sidebar actions: routes actions
- Input dispatcher → Undo and redo: handles shortcuts
- Mouse handling → Canvas operations: paints canvas
- Mouse handling → Sidebar actions: selects controls
- Sidebar actions → Brush sets: selects brush
- Sidebar actions → Canvas operations: resizes canvas
- Sidebar actions → Pattern replacement: configures replacement
- Sidebar actions → Clipboard actions: requests copy or paste
- Canvas operations → Undo and redo: saves state
- Pattern replacement → Undo and redo: saves state
- Undo and redo → Canvas operations: restores canvas
- Clipboard actions → System clipboard: reads or writes
- Terminal rendering → Brush sets: reads selection
- Terminal rendering → Zoom rendering: renders scaled canvas
- Terminal rendering → Terminal: displays editor
- Editor user → Terminal rendering: views result
