# choyeun/obsidian-color-highlighter architecture

> Architecture diagram of the GitHub repository choyeun/obsidian-color-highlighter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/choyeun/obsidian-color-highlighter
- Repository: https://github.com/choyeun/obsidian-color-highlighter

## Overview

##### Main Components

A. Core Plugin Components:
- Plugin Main Module (main.ts)
- Settings Management
- UI Components (styles.css)
- Configuration Handling (manifest.json)

B. Integration Points:
- Obsidian API Interface
- Editor Integration
- Command Palette Integration
- Settings Tab Integration

**┌─────────────────────────────────────────┐**
- Obsidian Application         │
- ┤
- ┌──────────────┐      ┌──────────────┐ │
- UI Layer   │      │   Settings   │ │
- Ribbon Btn │◄────►│  Management  │ │
- Picker     │      │             │ │
- ┬───────┘      └──────┬───────┘ │

- ┌──────▼───────┐      ┌─────▼───────┐ │
- Core       │      │  Storage    │ │
- Highlighting │◄────►│  Interface  │ │
- Engine     │      │            │ │
- ┘      └────────────┘ │
- ┘

##### Component Details

a) UI Layer:
- Ribbon buttons for highlight application/removal
- Settings panel interface

b) Core Highlighting Engine:
- Word processing logic
- Text manipulation functions

c) Settings Management:
- Configuration persistence

d) Storage Interface:
- Local storage interaction
- Configuration file handling

##### Interaction Flows

- User interaction flow (UI → Core Engine)
- Data persistence flow (Core Engine ↔ Storage)
- Settings update flow (Settings → Core Engine)
- Configuration loading flow (Storage → Settings)

##### Additional Elements

Annotations for:
- File types (.ts, .css, .json)
- Key configuration files (manifest.json, package.json)
- Build process elements (esbuild.config.mjs)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Obsidian["Obsidian Application"]
        API[Obsidian API Interface]
    end

    subgraph Plugin["Color Highlighter Plugin"]
        subgraph UI["UI Layer"]
            RibbonBtn[Ribbon Button]
            ColorPicker[Color Picker]
            SettingsPanel[Settings Panel]
        end

        subgraph Core["Core Components"]
            MainModule[Plugin Main Module]:::file
            HighlightEngine[Highlighting Engine]
            StylesComponent[UI Styles]:::file
        end

        subgraph Config["Configuration & Settings"]
            Settings[Settings Management]
            ConfigFile[Plugin Configuration]:::file
            VersionFile[Version Info]:::file
            BuildConfig[Build Configuration]:::file
            TSConfig[TypeScript Config]:::file
            PackageConfig[Package Config]:::file
        end

        subgraph Storage["Storage Layer"]
            LocalStorage[Local Storage Interface]
            DataPersistence[Data Persistence]
        end
    end

    %% Relationships
    API --> MainModule
    MainModule --> HighlightEngine
    HighlightEngine --> StylesComponent
    RibbonBtn --> HighlightEngine
    ColorPicker --> HighlightEngine
    SettingsPanel --> Settings
    Settings --> LocalStorage
    LocalStorage --> DataPersistence
    ConfigFile --> Settings
    VersionFile --> MainModule
    BuildConfig --> MainModule
    TSConfig --> MainModule
    PackageConfig --> MainModule

    %% Click Events
    click MainModule "https://github.com/choyeun/obsidian-color-highlighter/blob/master/main.ts"
    click StylesComponent "https://github.com/choyeun/obsidian-color-highlighter/blob/master/styles.css"
    click ConfigFile "https://github.com/choyeun/obsidian-color-highlighter/blob/master/manifest.json"
    click VersionFile "https://github.com/choyeun/obsidian-color-highlighter/blob/master/versions.json"
    click BuildConfig "https://github.com/choyeun/obsidian-color-highlighter/blob/master/esbuild.config.mjs"
    click TSConfig "https://github.com/choyeun/obsidian-color-highlighter/blob/master/tsconfig.json"
    click PackageConfig "https://github.com/choyeun/obsidian-color-highlighter/blob/master/package.json"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef file fill:#e1f5fe,stroke:#0288d1,stroke-width:2px
    classDef ui fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
    classDef core fill:#fff3e0,stroke:#f57c00,stroke-width:2px
    classDef storage fill:#fce4ec,stroke:#c2185b,stroke-width:2px

    class RibbonBtn,ColorPicker,SettingsPanel ui
    class HighlightEngine,MainModule core
    class LocalStorage,DataPersistence storage

    %% Legend
    subgraph Legend
        UI_Component[UI Component]:::ui
        Core_Component[Core Component]:::core
        Storage_Component[Storage Component]:::storage
        File_Component[Configuration File]:::file
    end
```
