# wwwoper/gh-switcher architecture

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

- Interactive diagram: https://gitdiagram.com/wwwoper/gh-switcher
- Repository: https://github.com/wwwoper/gh-switcher

## Overview

gh-switcher is a small browser extension that adds local links from GitHub repository pages to GitIngest and GitDiagram, and changes the toolbar icon according to the active tab’s host. The primary workflow is repository page → injected buttons → external service. A separate background workflow handles tab events and icon updates. The README documents the manifest and button styling; their precise wiring is not shown in the sampled source, so those connections are marked unverified.

Main entry points: [`extension/content.js`](https://github.com/wwwoper/gh-switcher/blob/main/extension/content.js) (Repository buttons), [`extension/manifest.json`](https://github.com/wwwoper/gh-switcher/blob/main/extension/manifest.json) (Extension manifest), [`extension/background.js`](https://github.com/wwwoper/gh-switcher/blob/main/extension/background.js) (Tab icon updater), [`extension/content.css`](https://github.com/wwwoper/gh-switcher/blob/main/extension/content.css) (Button styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_page_ui["Repository page UI"]
  node_content_script["Repository buttons<br/>[content.js]"]
  node_button_styles["Button styles<br/>[content.css]"]
  node_manifest["Extension manifest<br/>[manifest.json]"]
end

subgraph group_tab_icon["Tab icon behavior"]
  node_background["Tab icon updater<br/>[background.js]"]
  node_icons["Color and gray icons"]
end

subgraph group_external_tools["External tools"]
  node_gitingest["GitIngest"]
  node_gitdiagram["GitDiagram"]
end

node_github_page(("GitHub repository page"))

node_github_page -->|"renders on"| node_content_script
node_content_script -->|"links to"| node_gitingest
node_content_script -->|"links to"| node_gitdiagram
node_content_script -.->|"styled by"| node_button_styles
node_manifest -.->|"configures"| node_content_script
node_manifest -.->|"configures"| node_background
node_background -->|"selects"| node_icons

click node_content_script "https://github.com/wwwoper/gh-switcher/blob/main/extension/content.js"
click node_button_styles "https://github.com/wwwoper/gh-switcher/blob/main/extension/content.css"
click node_manifest "https://github.com/wwwoper/gh-switcher/blob/main/extension/manifest.json"
click node_background "https://github.com/wwwoper/gh-switcher/blob/main/extension/background.js"
click node_icons "https://github.com/wwwoper/gh-switcher/tree/main/extension/icons"

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_content_script,node_button_styles,node_manifest toneBlue
class node_background,node_icons toneAmber
class node_gitingest,node_gitdiagram toneMint
class node_github_page toneIndigo
```

## Components

### Repository page UI

- [Repository buttons](https://github.com/wwwoper/gh-switcher/blob/main/extension/content.js): `extension/content.js`
- [Button styles](https://github.com/wwwoper/gh-switcher/blob/main/extension/content.css): `extension/content.css`
- [Extension manifest](https://github.com/wwwoper/gh-switcher/blob/main/extension/manifest.json): `extension/manifest.json`

### Tab icon behavior

- [Tab icon updater](https://github.com/wwwoper/gh-switcher/blob/main/extension/background.js): `extension/background.js`
- [Color and gray icons](https://github.com/wwwoper/gh-switcher/tree/main/extension/icons): `extension/icons`

### External tools

- **GitIngest**
- **GitDiagram**

### Other components

- **GitHub repository page**

## Connections

- GitHub repository page → Repository buttons: renders on (evidence: `README.md`)
- Repository buttons → GitIngest: links to (evidence: `extension/content.js`)
- Repository buttons → GitDiagram: links to (evidence: `extension/content.js`)
- Repository buttons → Button styles: styled by (evidence: `README.md`)
- Extension manifest → Repository buttons: configures
- Extension manifest → Tab icon updater: configures
- Tab icon updater → Color and gray icons: selects (evidence: `extension/background.js`)
