# msmmstg/color-ai-core architecture

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

- Interactive diagram: https://gitdiagram.com/msmmstg/color-ai-core
- Repository: https://github.com/msmmstg/color-ai-core

## Overview

color-ai-core is a Python library for training color classifiers and naming colors from RGB values or images. Users can load a built-in model, classify RGB directly, or extract an image’s dominant color before classification. Models can be trained from synthetic color anchors or labeled photo folders, then saved and loaded as joblib files. The graph includes the documented library and CLI entry points; runtime relationships are based on the shown source and README, not on unsampled implementation.

Main entry points: [`color_ai_core/classify_image.py`](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_image.py) (Image classifier CLI), [`color_ai_core/train_from_photos.py`](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/train_from_photos.py) (Photo training), [`color_ai_core/color_core.py`](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py) (Dominant color extraction), [`color_ai_core/classify_rgb.py`](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_rgb.py) (RGB classifier CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_public_api["Library API<br/>[__init__.py]"]
  node_rgb_cli["RGB classifier CLI<br/>[classify_rgb.py]"]
  node_image_cli["Image classifier CLI<br/>[classify_image.py]"]
end

subgraph group_classify["Color classification"]
  node_rgb_input["RGB input"]
  node_photo_input["Photo input"]
  node_image_color["Dominant color extraction<br/>[color_core.py]"]
  node_features_predict["Features and prediction<br/>[color_core.py]"]
  node_model_loader["Model loading<br/>[color_core.py]"]
end

subgraph group_training["Model training"]
  node_synthetic_train["Synthetic training"]
  node_photo_train["Photo training"]
  node_labeled_photos["Labeled photo folders"]
  node_feature_builder["RGB feature conversion<br/>[color_core.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_model_files[("Joblib model files")]
end

node_user(("User or script"))

node_user -->|"calls"| node_public_api
node_user -->|"runs"| node_rgb_cli
node_user -->|"runs"| node_image_cli
node_rgb_cli -->|"loads model"| node_model_loader
node_rgb_cli -->|"classifies RGB"| node_features_predict
node_image_cli -->|"loads model"| node_model_loader
node_image_cli -->|"extracts color"| node_image_color
node_image_cli -->|"classifies color"| node_features_predict
node_user -->|"provides RGB"| node_rgb_input
node_rgb_input -.->|"predicts name"| node_features_predict
node_user -->|"provides photo"| node_photo_input
node_photo_input -->|"extracts dominant"| node_image_color
node_image_color -->|"supplies RGB"| node_features_predict
node_model_loader -->|"reads"| node_model_files
node_user -->|"trains model"| node_synthetic_train
node_synthetic_train -->|"converts samples"| node_feature_builder
node_synthetic_train -->|"writes model"| node_model_files
node_user -->|"provides folders"| node_labeled_photos
node_labeled_photos -->|"trains from images"| node_photo_train
node_photo_train -->|"extracts dominant"| node_image_color
node_photo_train -->|"converts samples"| node_feature_builder
node_photo_train -->|"writes model"| node_model_files

click node_public_api "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/__init__.py"
click node_rgb_cli "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_rgb.py"
click node_image_cli "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_image.py"
click node_image_color "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py"
click node_features_predict "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py"
click node_model_loader "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py"
click node_synthetic_train "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/train_color_classifier.py"
click node_photo_train "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/train_from_photos.py"
click node_feature_builder "https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py"

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_public_api,node_rgb_cli,node_image_cli,node_user toneBlue
class node_rgb_input,node_photo_input,node_image_color,node_features_predict,node_model_loader toneAmber
class node_synthetic_train,node_photo_train,node_labeled_photos,node_feature_builder toneMint
class node_model_files toneRose
```

## Components

### User entry points

- [Library API](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/__init__.py): `color_ai_core/__init__.py`
- [RGB classifier CLI](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_rgb.py): `color_ai_core/classify_rgb.py`
- [Image classifier CLI](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/classify_image.py): `color_ai_core/classify_image.py`

### Color classification

- **RGB input**
- **Photo input**
- [Dominant color extraction](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py): `color_ai_core/color_core.py`
- [Features and prediction](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py): `color_ai_core/color_core.py`
- [Model loading](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py): `color_ai_core/color_core.py`

### Model training

- [Synthetic training](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/train_color_classifier.py): `color_ai_core/train_color_classifier.py`
- [Photo training](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/train_from_photos.py): `color_ai_core/train_from_photos.py`
- **Labeled photo folders**
- [RGB feature conversion](https://github.com/msmmstg/color-ai-core/blob/main/color_ai_core/color_core.py): `color_ai_core/color_core.py`

### Model artifacts

- **Joblib model files**

### Other components

- **User or script**

## Connections

- User or script → Library API: calls (evidence: `README.md`)
- User or script → RGB classifier CLI: runs (evidence: `README.md`)
- User or script → Image classifier CLI: runs (evidence: `README.md`)
- RGB classifier CLI → Model loading: loads model (evidence: `color_ai_core/classify_rgb.py`)
- RGB classifier CLI → Features and prediction: classifies RGB (evidence: `color_ai_core/classify_rgb.py`)
- Image classifier CLI → Model loading: loads model (evidence: `color_ai_core/classify_image.py`)
- Image classifier CLI → Dominant color extraction: extracts color (evidence: `color_ai_core/classify_image.py`)
- Image classifier CLI → Features and prediction: classifies color (evidence: `color_ai_core/classify_image.py`)
- User or script → RGB input: provides RGB (evidence: `README.md`)
- RGB input → Features and prediction: predicts name
- User or script → Photo input: provides photo (evidence: `README.md`)
- Photo input → Dominant color extraction: extracts dominant (evidence: `color_ai_core/color_core.py`)
- Dominant color extraction → Features and prediction: supplies RGB (evidence: `color_ai_core/classify_image.py`)
- Model loading → Joblib model files: reads (evidence: `color_ai_core/color_core.py`)
- User or script → Synthetic training: trains model (evidence: `README.md`)
- Synthetic training → RGB feature conversion: converts samples (evidence: `color_ai_core/train_color_classifier.py`)
- Synthetic training → Joblib model files: writes model (evidence: `color_ai_core/train_color_classifier.py`)
- User or script → Labeled photo folders: provides folders (evidence: `README.md`)
- Labeled photo folders → Photo training: trains from images (evidence: `README.md`)
- Photo training → Dominant color extraction: extracts dominant (evidence: `color_ai_core/train_from_photos.py`)
- Photo training → RGB feature conversion: converts samples (evidence: `color_ai_core/train_from_photos.py`)
- Photo training → Joblib model files: writes model (evidence: `color_ai_core/train_from_photos.py`)
