# alabsi91/reanimated-color-picker architecture

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

- Interactive diagram: https://gitdiagram.com/alabsi91/reanimated-color-picker
- Repository: https://github.com/alabsi91/reanimated-color-picker

## Overview

##### Main Components
- Source of the main components is the “src” directory.
- Includes primary feature files such as ColorPicker.tsx, components (InputWidget, Panels, Sliders, Thumb, and Preview), and helper modules (colorKit, utils, types).
- UI Components:
- Panels (Panels/Panel1, Panel2, Panel3…) and Sliders (HSB, HSL, Hue, RGB, Opacity) that facilitate multiple input methods.
- Thumb components for providing diverse interactive handles (e.g., Circle, DoubleTriangle, etc.).
- Example Implementations:
- The “Example” and “ExampleExpo” folders represent demonstration apps that integrate and showcase the library.
- The Android and iOS folders under “Example” indicate platform‐specific native projects.
- Supporting Materials:
- Docs: the “docs” directory contains generated documentation and static assets (build, API docs) that help users understand the API.

##### Out Relationships and Interactions
- External Dependencies:
- Example and Documentation Layers:
- “Example (Bare & Expo)” nodes connected to the core library showing usage scenarios.
- “Docs” node (with a link to the live documentation) connected to the core, representing developer guidance.
- Optionally, include a “Tests” node that connects to the core and UI components, demonstrating that the library’s functionality is verified through extensive tests.

##### Architectural Patterns & Design Principles
- Modularity & Reusability: The system is split into highly modular UI components, each encapsulated in its own directory. Highlight this by grouping similar components (all Panels, all Sliders) together.
- Separation of Concerns: There is a clear separation between:
- Presentation/UI (React components in “src/components”)
- Multi-platform Support:
- Integration with External Libraries:
- Explicitly mark nodes for “react-native-reanimated” and “react-native-gesture-handler” to stress the dependency for animations and gestures.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Library Layer
    subgraph "Core Library"
        core1["Reanimated Color Picker Core"]:::core
        cp["ColorPicker Component"]:::core
        core1 -->|"contains"| cp
    end

    %% UI Components Layer
    subgraph "UI Components"
        ui1["InputWidget"]:::ui
        ui2["Panels"]:::ui
        ui3["Sliders"]:::ui
        ui4["Thumb"]:::ui
        subgraph "Preview Components"
            ui5["Preview"]:::ui
            ui6["PreviewText"]:::ui
        end
    end

    %% Helper Utilities Layer
    subgraph "Helper Utilities"
        util1["ColorKit"]:::utility
        util2["Shared Utils"]:::utility
    end

    %% External Dependencies
    subgraph "External Dependencies"
        ext1["react-native-reanimated"]:::ext
        ext2["react-native-gesture-handler"]:::ext
    end

    %% Example and Support Layer
    subgraph "Example & Support"
        ex1["Example (Bare)"]:::example
        ex2["Example (Expo)"]:::example
        doc["Documentation"]:::doc
        t1["Tests (Root)"]:::test
        t2["Tests (Example)"]:::test
    end

    %% Connections from External Dependencies to Core
    ext1 -->|"supports"| core1
    ext2 -->|"supports"| core1

    %% Connections from Core Library to UI Components
    core1 -->|"utilizes"| ui1
    core1 -->|"utilizes"| ui2
    core1 -->|"utilizes"| ui3
    core1 -->|"utilizes"| ui4
    core1 -->|"triggers"| ui5

    %% Bidirectional interactions between InputWidget and Panels/Sliders
    ui1 <-->|"updates"| ui2
    ui1 <-->|"updates"| ui3

    %% Connections from Core Library to Helper Utilities
    core1 -->|"leverages"| util1
    core1 -->|"leverages"| util2

    %% Connections from Example & Support to Core
    ex1 -->|"demonstrates"| core1
    ex2 -->|"demonstrates"| core1
    doc -->|"guides"| core1
    t1 -->|"verifies"| core1
    t2 -->|"verifies"| core1

    %% Click Events
    click core1 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src"
    click cp "https://github.com/alabsi91/reanimated-color-picker/blob/main/src/ColorPicker.tsx"
    click ui1 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src/components/InputWidget"
    click ui2 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src/components/Panels"
    click ui3 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src/components/Sliders"
    click ui4 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src/components/Thumb"
    click ui5 "https://github.com/alabsi91/reanimated-color-picker/blob/main/src/components/Preview.tsx"
    click ui6 "https://github.com/alabsi91/reanimated-color-picker/blob/main/src/components/PreviewText.tsx"
    click util1 "https://github.com/alabsi91/reanimated-color-picker/tree/main/src/colorKit"
    click util2 "https://github.com/alabsi91/reanimated-color-picker/blob/main/src/utils.tsx"
    click ex1 "https://github.com/alabsi91/reanimated-color-picker/tree/main/Example"
    click ex2 "https://github.com/alabsi91/reanimated-color-picker/tree/main/ExampleExpo"
    click doc "https://github.com/alabsi91/reanimated-color-picker/tree/main/docs"
    click t1 "https://github.com/alabsi91/reanimated-color-picker/tree/main/__tests__"
    click t2 "https://github.com/alabsi91/reanimated-color-picker/tree/main/Example/__tests__"

    %% Styles
    classDef core fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef ui fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef utility fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef ext fill:#F5B7B1,stroke:#CB4335,stroke-width:2px;
    classDef example fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef doc fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef test fill:#F5CBA7,stroke:#BA4A00,stroke-width:2px;
```
