@trishchuk/coolors-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +39 -0
- package/.env +2 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +73 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +71 -0
- package/.github/pull_request_template.md +97 -0
- package/.github/workflows/ci.yml +127 -0
- package/.github/workflows/deploy-docs.yml +56 -0
- package/.github/workflows/release.yml +99 -0
- package/.mcp.json +12 -0
- package/.prettierignore +1 -0
- package/CLAUDE.md +201 -0
- package/DOCUMENTATION.md +274 -0
- package/GEMINI.md +54 -0
- package/LICENSE +21 -0
- package/README.md +401 -0
- package/demo/content_based_color.png +0 -0
- package/demo/music-player.html +621 -0
- package/demo/podcast-player.html +903 -0
- package/dist/bin/coolors-mcp.d.ts +1 -0
- package/dist/bin/coolors-mcp.js +154 -0
- package/dist/bin/coolors-mcp.js.map +1 -0
- package/dist/bin/server.d.ts +1 -0
- package/dist/bin/server.js +3292 -0
- package/dist/bin/server.js.map +1 -0
- package/dist/chunk-IQ7NN26V.js +114 -0
- package/dist/chunk-IQ7NN26V.js.map +1 -0
- package/dist/chunk-P3ARRKLS.js +1214 -0
- package/dist/chunk-P3ARRKLS.js.map +1 -0
- package/dist/color/index.d.ts +716 -0
- package/dist/color/index.js +153 -0
- package/dist/color/index.js.map +1 -0
- package/dist/coolors-mcp.d.ts +136 -0
- package/dist/coolors-mcp.js +7 -0
- package/dist/coolors-mcp.js.map +1 -0
- package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
- package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
- package/docs/.vitepress/cache/deps/_metadata.json +127 -0
- package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
- package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +12683 -0
- package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js.map +7 -0
- package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +9719 -0
- package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js.map +7 -0
- package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
- package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
- package/docs/.vitepress/cache/deps/cytoscape.js +30278 -0
- package/docs/.vitepress/cache/deps/cytoscape.js.map +7 -0
- package/docs/.vitepress/cache/deps/dayjs.js +285 -0
- package/docs/.vitepress/cache/deps/dayjs.js.map +7 -0
- package/docs/.vitepress/cache/deps/debug.js +468 -0
- package/docs/.vitepress/cache/deps/debug.js.map +7 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/prismjs.js +1466 -0
- package/docs/.vitepress/cache/deps/prismjs.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +228 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +142 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +27 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +65 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +53 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js.map +7 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +73 -0
- package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1146 -0
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1814 -0
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +344 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/components/ClientGrid.vue +125 -0
- package/docs/.vitepress/components/CodeBlock.vue +231 -0
- package/docs/.vitepress/components/ConfigModal.vue +477 -0
- package/docs/.vitepress/components/DiagramModal.vue +528 -0
- package/docs/.vitepress/components/TroubleshootingModal.vue +472 -0
- package/docs/.vitepress/config.js +162 -0
- package/docs/.vitepress/theme/FundingLayout.vue +251 -0
- package/docs/.vitepress/theme/Layout.vue +134 -0
- package/docs/.vitepress/theme/components/AdBanner.vue +317 -0
- package/docs/.vitepress/theme/components/AdPlaceholder.vue +78 -0
- package/docs/.vitepress/theme/components/FundingEffects.vue +322 -0
- package/docs/.vitepress/theme/components/FundingHero.vue +345 -0
- package/docs/.vitepress/theme/components/SupportSection.vue +511 -0
- package/docs/.vitepress/theme/custom-app.css +339 -0
- package/docs/.vitepress/theme/custom.css +699 -0
- package/docs/.vitepress/theme/index.js +25 -0
- package/docs/README.md +198 -0
- package/docs/concepts/accessibility.md +473 -0
- package/docs/concepts/color-spaces.md +222 -0
- package/docs/concepts/distance-metrics.md +384 -0
- package/docs/concepts/hct.md +261 -0
- package/docs/concepts/image-analysis.md +396 -0
- package/docs/concepts/material-design.md +306 -0
- package/docs/concepts/theme-matching.md +399 -0
- package/docs/examples/basic-colors.md +490 -0
- package/docs/examples/creating-themes.md +898 -0
- package/docs/examples/css-refactoring.md +824 -0
- package/docs/examples/image-extraction.md +882 -0
- package/docs/getting-started.md +366 -0
- package/docs/index.md +190 -0
- package/docs/installation.md +157 -0
- package/docs/tools/README.md +234 -0
- package/docs/tools/accessibility.md +614 -0
- package/docs/tools/color-operations.md +374 -0
- package/docs/tools/image-extraction.md +624 -0
- package/docs/tools/material-design.md +347 -0
- package/docs/tools/theme-matching.md +552 -0
- package/eslint.config.ts +14 -0
- package/examples/theme-matching.md +113 -0
- package/jsr.json +7 -0
- package/mcp-config.json +8 -0
- package/note.md +35 -0
- package/package.json +122 -0
- package/research_results.md +53 -0
- package/src/bin/coolors-mcp.ts +194 -0
- package/src/bin/server.ts +61 -0
- package/src/color/__tests__/conversions-argb.test.ts +198 -0
- package/src/color/__tests__/extract-colors.test.ts +360 -0
- package/src/color/__tests__/image-utils.test.ts +242 -0
- package/src/color/__tests__/reference-colors.test.ts +278 -0
- package/src/color/__tests__/round-trip.test.ts +197 -0
- package/src/color/conversions.test.ts +402 -0
- package/src/color/conversions.ts +393 -0
- package/src/color/dislike/__tests__/dislike-analyzer.test.ts +248 -0
- package/src/color/dislike/dislike-analyzer.ts +114 -0
- package/src/color/extract-colors.ts +228 -0
- package/src/color/hct/__tests__/hct-class.test.ts +232 -0
- package/src/color/hct/harmonization.ts +204 -0
- package/src/color/hct/hct-class.ts +109 -0
- package/src/color/hct/hct-solver.ts +168 -0
- package/src/color/hct/index.ts +39 -0
- package/src/color/hct/tonal-palette.ts +211 -0
- package/src/color/hct/types.ts +88 -0
- package/src/color/image-utils.ts +79 -0
- package/src/color/index.ts +87 -0
- package/src/color/material-theme.ts +157 -0
- package/src/color/metrics.test.ts +276 -0
- package/src/color/metrics.ts +281 -0
- package/src/color/quantize/__tests__/quantizer_celebi.test.ts +195 -0
- package/src/color/quantize/lab_point_provider.ts +55 -0
- package/src/color/quantize/point_provider.ts +27 -0
- package/src/color/quantize/quantizer_celebi.ts +51 -0
- package/src/color/quantize/quantizer_celebi_test.ts +71 -0
- package/src/color/quantize/quantizer_map.ts +47 -0
- package/src/color/quantize/quantizer_wsmeans.ts +232 -0
- package/src/color/quantize/quantizer_wu.ts +472 -0
- package/src/color/score/__tests__/score.test.ts +224 -0
- package/src/color/score/score.ts +175 -0
- package/src/color/types.ts +151 -0
- package/src/color/utils/color_utils.ts +292 -0
- package/src/color/utils/math_utils.ts +145 -0
- package/src/color/utils.test.ts +403 -0
- package/src/color/utils.ts +315 -0
- package/src/constants.ts +5 -0
- package/src/coolors-mcp.ts +37 -0
- package/src/examples/addition.ts +333 -0
- package/src/examples/color-demo.ts +125 -0
- package/src/examples/custom-logger.ts +201 -0
- package/src/examples/oauth-server.ts +113 -0
- package/src/examples/session-context.ts +269 -0
- package/src/session.ts +116 -0
- package/src/theme/__tests__/matcher.test.ts +180 -0
- package/src/theme/__tests__/parser.test.ts +148 -0
- package/src/theme/__tests__/refactor.test.ts +224 -0
- package/src/theme/index.ts +34 -0
- package/src/theme/matcher.ts +395 -0
- package/src/theme/parser.ts +392 -0
- package/src/theme/refactor.ts +360 -0
- package/src/theme/types.ts +152 -0
- package/src/tools/__tests__/gradient-generator.test.ts +206 -0
- package/src/tools/__tests__/palette-with-locks.test.ts +109 -0
- package/src/tools/color-conversion.tool.ts +54 -0
- package/src/tools/color-distance.tool.ts +41 -0
- package/src/tools/colors.ts +31 -0
- package/src/tools/contrast-checker.tool.ts +37 -0
- package/src/tools/dislike-analyzer.tool.ts +247 -0
- package/src/tools/gradient-generator.tool.ts +250 -0
- package/src/tools/image-extraction.tools.ts +289 -0
- package/src/tools/index.ts +39 -0
- package/src/tools/material-theme.tools.ts +250 -0
- package/src/tools/palette-generator.tool.ts +135 -0
- package/src/tools/palette-with-locks.tool.ts +221 -0
- package/src/tools/registry.ts +142 -0
- package/src/tools/simple-tools.ts +37 -0
- package/src/tools/theme-matching.tools.ts +334 -0
- package/src/types.ts +182 -0
- package/src/utils.ts +22 -0
- package/tsconfig.json +8 -0
- package/vitest.config.js +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# Coolors MCP
|
|
2
|
+
|
|
3
|
+
Advanced color operations MCP server with Material Design 3 support, CSS theme matching, image color extraction, and accessibility compliance.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Color Space Conversions** - RGB, HSL, HSV, LAB, XYZ, and Google's HCT
|
|
8
|
+
- 📏 **Perceptual Color Metrics** - Delta E (76/94/2000) and HCT-based distance
|
|
9
|
+
- 🎭 **Material Design 3** - Complete theme generation with tonal palettes
|
|
10
|
+
- 🔍 **Smart Theme Matching** - Find closest CSS variables for any color
|
|
11
|
+
- 🖼️ **Image Color Extraction** - Extract dominant colors using Celebi quantization
|
|
12
|
+
- ♿ **WCAG Compliance** - Automatic contrast ratio checking
|
|
13
|
+
- 🔄 **CSS Refactoring** - Automated legacy color replacement with theme variables
|
|
14
|
+
- 🎯 **Context-Aware** - Different matching strategies for text, background, borders
|
|
15
|
+
- 🌈 **Advanced Palette Generation** - Create palettes with locked colors
|
|
16
|
+
- 🎨 **Gradient Generation** - Smooth gradients with multiple interpolation methods
|
|
17
|
+
- 🚫 **Dislike Analysis** - Detect and fix universally disliked colors
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @trishchuk/coolors-mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or for development:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/x51xxx/coolors-mcp
|
|
29
|
+
cd coolors-mcp
|
|
30
|
+
npm install
|
|
31
|
+
npm run build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Run as MCP Server
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Run the built server
|
|
40
|
+
node dist/bin/server.js
|
|
41
|
+
|
|
42
|
+
# Or use with MCP Inspector for testing
|
|
43
|
+
npx fastmcp inspect src/bin/server.ts
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Configure with Claude Desktop
|
|
47
|
+
|
|
48
|
+
Add to your Claude Desktop configuration:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"coolors": {
|
|
54
|
+
"command": "node",
|
|
55
|
+
"args": ["/path/to/coolors-mcp/dist/bin/server.js"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Available Tools
|
|
62
|
+
|
|
63
|
+
### Core Color Operations
|
|
64
|
+
|
|
65
|
+
#### `convert_color`
|
|
66
|
+
|
|
67
|
+
Convert colors between formats (hex, rgb, hsl, lab, hct).
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
{
|
|
71
|
+
"color": "#6750a4",
|
|
72
|
+
"to": "hct"
|
|
73
|
+
}
|
|
74
|
+
// Output: "hct(258.1, 47.3, 41.2)"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### `color_distance`
|
|
78
|
+
|
|
79
|
+
Calculate perceptual distance between colors.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
{
|
|
83
|
+
"color1": "#6750a4",
|
|
84
|
+
"color2": "#7f67be",
|
|
85
|
+
"metric": "deltaE2000"
|
|
86
|
+
}
|
|
87
|
+
// Output: "Distance: 8.45"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### `check_contrast`
|
|
91
|
+
|
|
92
|
+
Check WCAG contrast ratio compliance.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
{
|
|
96
|
+
"foreground": "#000000",
|
|
97
|
+
"background": "#ffffff"
|
|
98
|
+
}
|
|
99
|
+
// Output: Contrast Ratio: 21.00:1 ✓ WCAG AAA
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Palette Generation
|
|
103
|
+
|
|
104
|
+
#### `generate_palette`
|
|
105
|
+
|
|
106
|
+
Generate color palettes (monochromatic, analogous, complementary, triadic, tetradic).
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
{
|
|
110
|
+
"baseColor": "#6750a4",
|
|
111
|
+
"type": "analogous",
|
|
112
|
+
"count": 5
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### `generate_palette_with_locks`
|
|
117
|
+
|
|
118
|
+
Generate palettes while preserving specific colors.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
{
|
|
122
|
+
"lockedColors": ["#6750a4", "#ff6b6b"],
|
|
123
|
+
"totalColors": 7,
|
|
124
|
+
"mode": "harmony", // or "contrast", "gradient"
|
|
125
|
+
"colorSpace": "lab" // or "hsl"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### `generate_gradient`
|
|
130
|
+
|
|
131
|
+
Create smooth gradients with advanced interpolation.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
{
|
|
135
|
+
"colors": ["#6750a4", "#ff6b6b"],
|
|
136
|
+
"steps": 10,
|
|
137
|
+
"interpolation": "lab", // or "hsl", "rgb", "lch", "hct"
|
|
138
|
+
"easing": "ease-in-out", // or "linear", "ease-in", "ease-out"
|
|
139
|
+
"format": "css-linear" // or "array", "hex", "css-radial"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Material Design 3
|
|
144
|
+
|
|
145
|
+
#### `generate_material_theme`
|
|
146
|
+
|
|
147
|
+
Generate complete Material Design 3 color theme.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
{
|
|
151
|
+
"sourceColor": "#6750a4",
|
|
152
|
+
"includeCustomColors": true
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### `generate_tonal_palette`
|
|
157
|
+
|
|
158
|
+
Create Material Design tonal palettes.
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
{
|
|
162
|
+
"color": "#6750a4",
|
|
163
|
+
"tones": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 100]
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `harmonize_colors`
|
|
168
|
+
|
|
169
|
+
Harmonize multiple colors to work together.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
{
|
|
173
|
+
"colors": ["#6750a4", "#ff6b6b", "#4ecdc4"],
|
|
174
|
+
"method": "harmonize", // or "blend", "temperature"
|
|
175
|
+
"factor": 0.5
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### CSS Theme Matching
|
|
180
|
+
|
|
181
|
+
#### `match_theme_color`
|
|
182
|
+
|
|
183
|
+
Find closest theme variable for any color.
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
{
|
|
187
|
+
"color": "#6850a0",
|
|
188
|
+
"themeCSS": ":root { --color-primary-40: #6750a4; }",
|
|
189
|
+
"context": "background",
|
|
190
|
+
"minConfidence": 70
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### `refactor_css_with_theme`
|
|
195
|
+
|
|
196
|
+
Automatically refactor CSS to use theme variables.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
{
|
|
200
|
+
"css": ".button { background: #6750a4; }",
|
|
201
|
+
"themeCSS": ":root { --color-primary-40: #6750a4; }",
|
|
202
|
+
"preserveOriginal": true,
|
|
203
|
+
"generateReport": true
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### `generate_theme_css`
|
|
208
|
+
|
|
209
|
+
Generate CSS custom properties for a complete theme.
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
{
|
|
213
|
+
"sourceColor": "#6750a4",
|
|
214
|
+
"prefix": "color",
|
|
215
|
+
"includeTones": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 100]
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Image Color Extraction
|
|
220
|
+
|
|
221
|
+
#### `extract_image_colors`
|
|
222
|
+
|
|
223
|
+
Extract dominant colors from images using Celebi quantization.
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
{
|
|
227
|
+
"imageData": {
|
|
228
|
+
"data": [/* RGBA array */],
|
|
229
|
+
"width": 1920,
|
|
230
|
+
"height": 1080
|
|
231
|
+
},
|
|
232
|
+
"maxColors": 5,
|
|
233
|
+
"quality": "high",
|
|
234
|
+
"format": "json"
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### `generate_theme_from_image`
|
|
239
|
+
|
|
240
|
+
Generate Material Design theme from image colors.
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
{
|
|
244
|
+
"imageData": {/* image data */},
|
|
245
|
+
"isDark": false,
|
|
246
|
+
"includeCustomColors": true
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Color Psychology
|
|
251
|
+
|
|
252
|
+
#### `analyze_color_likability`
|
|
253
|
+
|
|
254
|
+
Check if colors fall in universally disliked ranges.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
{
|
|
258
|
+
"color": "#6b6b00" // Dark yellow-green
|
|
259
|
+
}
|
|
260
|
+
// Output: Analysis with fix suggestions
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### `fix_disliked_colors_batch`
|
|
264
|
+
|
|
265
|
+
Fix multiple disliked colors automatically.
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
{
|
|
269
|
+
"colors": ["#6b6b00", "#7a7a10", "#808020"],
|
|
270
|
+
"strategy": "hue_shift" // or "desaturate", "brighten"
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Color Science
|
|
275
|
+
|
|
276
|
+
### HCT Color Space
|
|
277
|
+
|
|
278
|
+
Google's HCT (Hue, Chroma, Tone) color space provides:
|
|
279
|
+
|
|
280
|
+
- **Hue** (0-360°): Color wheel position
|
|
281
|
+
- **Chroma** (0-150): Color intensity
|
|
282
|
+
- **Tone** (0-100): Lightness with guaranteed WCAG contrast
|
|
283
|
+
|
|
284
|
+
Key benefits:
|
|
285
|
+
|
|
286
|
+
- Tone difference of 40 = 3:1 contrast ratio
|
|
287
|
+
- Tone difference of 50 = 4.5:1 contrast ratio
|
|
288
|
+
- Perceptually uniform for UI design
|
|
289
|
+
|
|
290
|
+
### Interpolation Methods
|
|
291
|
+
|
|
292
|
+
Different color spaces for gradient generation:
|
|
293
|
+
|
|
294
|
+
- **RGB**: Simple but can produce muddy colors
|
|
295
|
+
- **HSL**: Good for hue-based transitions
|
|
296
|
+
- **LAB**: Perceptually uniform brightness
|
|
297
|
+
- **LCH**: Cylindrical LAB, smooth hue transitions
|
|
298
|
+
- **HCT**: Material Design optimized
|
|
299
|
+
|
|
300
|
+
### Theme Matching Algorithm
|
|
301
|
+
|
|
302
|
+
Multi-factor scoring system:
|
|
303
|
+
|
|
304
|
+
1. **Perceptual Distance (60%)** - HCT-based similarity
|
|
305
|
+
2. **Semantic Context (20%)** - Role appropriateness
|
|
306
|
+
3. **Accessibility (20%)** - Contrast compliance
|
|
307
|
+
|
|
308
|
+
## Development
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Install dependencies
|
|
312
|
+
npm install
|
|
313
|
+
|
|
314
|
+
# Build the project
|
|
315
|
+
npm run build
|
|
316
|
+
|
|
317
|
+
# Run tests
|
|
318
|
+
npm test
|
|
319
|
+
|
|
320
|
+
# Format code
|
|
321
|
+
npm run format
|
|
322
|
+
|
|
323
|
+
# Lint
|
|
324
|
+
npm run lint
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Architecture
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
src/
|
|
331
|
+
├── bin/
|
|
332
|
+
│ └── server.ts # MCP server entry
|
|
333
|
+
├── tools/ # Tool implementations
|
|
334
|
+
│ ├── color-conversion.tool.ts
|
|
335
|
+
│ ├── color-distance.tool.ts
|
|
336
|
+
│ ├── contrast-checker.tool.ts
|
|
337
|
+
│ ├── palette-generator.tool.ts
|
|
338
|
+
│ ├── palette-with-locks.tool.ts
|
|
339
|
+
│ ├── gradient-generator.tool.ts
|
|
340
|
+
│ ├── material-theme.tools.ts
|
|
341
|
+
│ ├── theme-matching.tools.ts
|
|
342
|
+
│ ├── image-extraction.tools.ts
|
|
343
|
+
│ └── dislike-analyzer.tool.ts
|
|
344
|
+
├── color/ # Core color utilities
|
|
345
|
+
│ ├── conversions.ts # Color space conversions
|
|
346
|
+
│ ├── metrics.ts # Distance calculations
|
|
347
|
+
│ ├── utils.ts # Color utilities
|
|
348
|
+
│ ├── hct/ # HCT color space
|
|
349
|
+
│ ├── quantize/ # Celebi quantization
|
|
350
|
+
│ ├── score/ # Color scoring
|
|
351
|
+
│ └── dislike/ # Dislike analysis
|
|
352
|
+
└── theme/ # Theme system
|
|
353
|
+
├── parser.ts # CSS parsing
|
|
354
|
+
├── matcher.ts # Variable matching
|
|
355
|
+
└── refactor.ts # CSS refactoring
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Use Cases
|
|
359
|
+
|
|
360
|
+
### Design System Migration
|
|
361
|
+
|
|
362
|
+
Convert hardcoded colors to CSS variables with confidence scores.
|
|
363
|
+
|
|
364
|
+
### Accessibility Compliance
|
|
365
|
+
|
|
366
|
+
Ensure all color combinations meet WCAG AA/AAA standards.
|
|
367
|
+
|
|
368
|
+
### Material Design Adoption
|
|
369
|
+
|
|
370
|
+
Generate complete Material Design 3 themes with tonal palettes.
|
|
371
|
+
|
|
372
|
+
### Brand Color Harmonization
|
|
373
|
+
|
|
374
|
+
Create cohesive palettes that work well together.
|
|
375
|
+
|
|
376
|
+
### Image-Based Theming
|
|
377
|
+
|
|
378
|
+
Extract colors from logos or photos to generate matching themes.
|
|
379
|
+
|
|
380
|
+
### Gradient Design
|
|
381
|
+
|
|
382
|
+
Create smooth, perceptually uniform gradients for modern UIs.
|
|
383
|
+
|
|
384
|
+
## Contributing
|
|
385
|
+
|
|
386
|
+
Contributions welcome! Please ensure:
|
|
387
|
+
|
|
388
|
+
- Tests pass (`npm test`)
|
|
389
|
+
- Code is formatted (`npm run format`)
|
|
390
|
+
- Type checking passes (`npm run lint`)
|
|
391
|
+
|
|
392
|
+
## License
|
|
393
|
+
|
|
394
|
+
MIT
|
|
395
|
+
|
|
396
|
+
## Credits
|
|
397
|
+
|
|
398
|
+
- Built with [MCP SDK](https://modelcontextprotocol.io/) by Anthropic
|
|
399
|
+
- Incorporates algorithms from [Material Color Utilities](https://github.com/material-foundation/material-color-utilities) by Google
|
|
400
|
+
- HCT color space developed for Material Design 3
|
|
401
|
+
- Celebi quantization algorithm for optimal color extraction
|
|
Binary file
|