# amrsubzero/iconfastfit architecture

> Architecture diagram of the GitHub repository amrsubzero/iconfastfit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amrsubzero/iconfastfit
- Repository: https://github.com/amrsubzero/iconfastfit

## Overview

Icon Fast Fit is a Photoshop CEP extension for fitting the active icon layer to a selection, with optional color styling and persistent settings. The panel collects settings and dispatches the fit through the CEP bridge to ExtendScript; a separate Photoshop Scripts-menu command loads the same host logic for global shortcuts. The README documents these capabilities, while the excerpts show the panel, bridge, host, and shortcut command; installer and packaging files are omitted.

Main entry points: [`host/host.jsx`](https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx) (Fit and validate layer), [`js/panel.js`](https://github.com/amrsubzero/iconfastfit/blob/master/js/panel.js) (Settings and dispatch), [`js/cep-bridge.js`](https://github.com/amrsubzero/iconfastfit/blob/master/js/cep-bridge.js) (CEP script bridge), [`global/Icon Fast Fit.jsx`](https://github.com/amrsubzero/iconfastfit/blob/master/global/Icon%20Fast%20Fit.jsx) (Scripts-menu command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_panel["CEP Panel"]
  node_panel_ui["Panel controls<br/>[index.html]"]
  node_panel_logic["Settings and dispatch<br/>[panel.js]"]
  node_bridge["CEP script bridge<br/>[cep-bridge.js]"]
end

subgraph group_host["Photoshop Host"]
  node_host_action["Fit and validate layer<br/>[host.jsx]"]
  node_overlay["Color Overlay<br/>[host.jsx]"]
  node_solid_fill["Clipped Solid Color<br/>[host.jsx]"]
  node_settings[("Persistent settings<br/>[host.jsx]")]
end

subgraph group_shortcut["Global Shortcut"]
  node_shortcut_command["Scripts-menu command<br/>[Icon Fast Fit.jsx]"]
end

node_user(("Photoshop user"))
node_photoshop["Photoshop"]

node_user -->|"operates"| node_panel_ui
node_panel_ui -->|"supplies controls"| node_panel_logic
node_panel_logic -->|"dispatches scripts"| node_bridge
node_bridge -->|"evaluates scripts"| node_photoshop
node_bridge -.->|"runs host code"| node_host_action
node_panel_logic -->|"saves host settings"| node_settings
node_host_action -->|"loads and saves"| node_settings
node_host_action -->|"fits and centers layer"| node_photoshop
node_host_action -->|"applies when enabled"| node_overlay
node_host_action -->|"creates when enabled"| node_solid_fill
node_user -->|"invokes shortcut"| node_shortcut_command
node_shortcut_command -->|"loads and runs"| node_host_action
node_shortcut_command -->|"runs saved settings"| node_settings

click node_panel_ui "https://github.com/amrsubzero/iconfastfit/blob/master/index.html"
click node_panel_logic "https://github.com/amrsubzero/iconfastfit/blob/master/js/panel.js"
click node_bridge "https://github.com/amrsubzero/iconfastfit/blob/master/js/cep-bridge.js"
click node_host_action "https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx"
click node_overlay "https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx"
click node_solid_fill "https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx"
click node_settings "https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx"
click node_shortcut_command "https://github.com/amrsubzero/iconfastfit/blob/master/global/Icon%20Fast%20Fit.jsx"

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_panel_ui,node_panel_logic,node_bridge,node_user toneBlue
class node_host_action,node_overlay,node_solid_fill,node_settings toneAmber
class node_shortcut_command toneMint
class node_photoshop toneIndigo
```

## Components

### CEP Panel

- [Panel controls](https://github.com/amrsubzero/iconfastfit/blob/master/index.html): `index.html`
- [Settings and dispatch](https://github.com/amrsubzero/iconfastfit/blob/master/js/panel.js): `js/panel.js`
- [CEP script bridge](https://github.com/amrsubzero/iconfastfit/blob/master/js/cep-bridge.js): `js/cep-bridge.js`

### Photoshop Host

- [Fit and validate layer](https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx): `host/host.jsx`
- [Color Overlay](https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx): `host/host.jsx`
- [Clipped Solid Color](https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx): `host/host.jsx`
- [Persistent settings](https://github.com/amrsubzero/iconfastfit/blob/master/host/host.jsx): `host/host.jsx`

### Global Shortcut

- [Scripts-menu command](https://github.com/amrsubzero/iconfastfit/blob/master/global/Icon%20Fast%20Fit.jsx): `global/Icon Fast Fit.jsx`

### Other components

- **Photoshop user**
- **Photoshop**

## Connections

- Photoshop user → Panel controls: operates (evidence: `README.md`)
- Panel controls → Settings and dispatch: supplies controls (evidence: `js/panel.js`)
- Settings and dispatch → CEP script bridge: dispatches scripts (evidence: `js/panel.js`)
- CEP script bridge → Photoshop: evaluates scripts (evidence: `js/cep-bridge.js`)
- CEP script bridge → Fit and validate layer: runs host code
- Settings and dispatch → Persistent settings: saves host settings (evidence: `js/panel.js`)
- Fit and validate layer → Persistent settings: loads and saves (evidence: `host/host.jsx`)
- Fit and validate layer → Photoshop: fits and centers layer (evidence: `host/host.jsx`)
- Fit and validate layer → Color Overlay: applies when enabled (evidence: `host/host.jsx`)
- Fit and validate layer → Clipped Solid Color: creates when enabled (evidence: `host/host.jsx`)
- Photoshop user → Scripts-menu command: invokes shortcut (evidence: `README.md`)
- Scripts-menu command → Fit and validate layer: loads and runs (evidence: `global/Icon Fast Fit.jsx`)
- Scripts-menu command → Persistent settings: runs saved settings (evidence: `global/Icon Fast Fit.jsx`)
