@trishchuk/coolors-mcp 1.0.0 → 1.0.1
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 +2 -6
- package/.github/ISSUE_TEMPLATE/bug_report.md +20 -8
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -8
- package/.github/pull_request_template.md +33 -8
- package/.github/workflows/ci.yml +97 -97
- package/.github/workflows/deploy-docs.yml +9 -9
- package/.github/workflows/release.yml +15 -15
- package/README.md +26 -1
- package/TOOLS_UK.md +233 -0
- package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +30 -12
- package/docs/.vitepress/cache/deps/_metadata.json +1 -1
- package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -6
- package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +2543 -1612
- package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +3508 -2529
- package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +1902 -1003
- package/docs/.vitepress/cache/deps/cytoscape.js +13303 -7347
- package/docs/.vitepress/cache/deps/dayjs.js +494 -272
- package/docs/.vitepress/cache/deps/debug.js +82 -38
- package/docs/.vitepress/cache/deps/prismjs.js +444 -272
- package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +80 -73
- package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +93 -62
- package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +13 -13
- package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +34 -27
- package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +20 -17
- package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +75 -41
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +2005 -1438
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +2 -2
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +566 -229
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +382 -270
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +334 -125
- package/docs/.vitepress/cache/deps/vue.js +2 -2
- package/docs/.vitepress/components/ClientGrid.vue +9 -3
- package/docs/.vitepress/components/CodeBlock.vue +51 -44
- package/docs/.vitepress/components/ConfigModal.vue +151 -67
- package/docs/.vitepress/components/DiagramModal.vue +186 -154
- package/docs/.vitepress/components/TroubleshootingModal.vue +101 -96
- package/docs/.vitepress/config.js +171 -141
- package/docs/.vitepress/theme/FundingLayout.vue +65 -54
- package/docs/.vitepress/theme/Layout.vue +21 -21
- package/docs/.vitepress/theme/components/AdBanner.vue +73 -52
- package/docs/.vitepress/theme/components/AdPlaceholder.vue +3 -3
- package/docs/.vitepress/theme/components/FundingEffects.vue +77 -53
- package/docs/.vitepress/theme/components/FundingHero.vue +78 -63
- package/docs/.vitepress/theme/components/SupportSection.vue +106 -89
- package/docs/.vitepress/theme/custom-app.css +19 -12
- package/docs/.vitepress/theme/custom.css +33 -25
- package/docs/.vitepress/theme/index.js +19 -16
- package/docs/concepts/accessibility.md +59 -47
- package/docs/concepts/color-spaces.md +28 -6
- package/docs/concepts/distance-metrics.md +45 -30
- package/docs/concepts/hct.md +30 -27
- package/docs/concepts/image-analysis.md +52 -21
- package/docs/concepts/material-design.md +43 -17
- package/docs/concepts/theme-matching.md +64 -40
- package/docs/examples/basic-colors.md +92 -108
- package/docs/examples/creating-themes.md +104 -108
- package/docs/examples/css-refactoring.md +33 -29
- package/docs/examples/image-extraction.md +145 -138
- package/docs/getting-started.md +45 -34
- package/docs/index.md +5 -1
- package/docs/installation.md +15 -1
- package/docs/tools/accessibility.md +74 -68
- package/docs/tools/image-extraction.md +62 -54
- package/docs/tools/theme-matching.md +45 -42
- package/note.md +1 -2
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ Replace a single hardcoded color with a theme variable:
|
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
// Find matching theme variable
|
|
13
|
-
"What theme variable matches #6366f1?"
|
|
13
|
+
"What theme variable matches #6366f1?";
|
|
14
14
|
|
|
15
15
|
// With theme CSS
|
|
16
16
|
const theme = `
|
|
@@ -323,8 +323,8 @@ const theme = `
|
|
|
323
323
|
{ color: "#6366f1", match: "--primary", confidence: 100 },
|
|
324
324
|
{ color: "#ec4899", match: "--accent", confidence: 100 },
|
|
325
325
|
{ color: "#10b981", match: "--success", confidence: 100 },
|
|
326
|
-
{ color: "#f59e0b", match: "--warning", confidence: 100 }
|
|
327
|
-
]
|
|
326
|
+
{ color: "#f59e0b", match: "--warning", confidence: 100 },
|
|
327
|
+
];
|
|
328
328
|
```
|
|
329
329
|
|
|
330
330
|
## Migration Strategies
|
|
@@ -350,15 +350,15 @@ Migrate large codebases incrementally:
|
|
|
350
350
|
|
|
351
351
|
```javascript
|
|
352
352
|
// 1. Start with utility classes
|
|
353
|
-
refactorFile(
|
|
353
|
+
refactorFile("styles/utilities.css", theme);
|
|
354
354
|
|
|
355
355
|
// 2. Then base components
|
|
356
|
-
refactorFile(
|
|
357
|
-
refactorFile(
|
|
356
|
+
refactorFile("styles/buttons.css", theme);
|
|
357
|
+
refactorFile("styles/forms.css", theme);
|
|
358
358
|
|
|
359
359
|
// 3. Finally, complex components
|
|
360
|
-
refactorFile(
|
|
361
|
-
refactorFile(
|
|
360
|
+
refactorFile("styles/navigation.css", theme);
|
|
361
|
+
refactorFile("styles/modals.css", theme);
|
|
362
362
|
```
|
|
363
363
|
|
|
364
364
|
### Creating Missing Variables
|
|
@@ -369,7 +369,7 @@ When colors don't match existing theme:
|
|
|
369
369
|
// Identify unmatched colors
|
|
370
370
|
const unmatched = [
|
|
371
371
|
{ color: "#7c3aed", usage: ["buttons", "links"] },
|
|
372
|
-
{ color: "#0ea5e9", usage: ["alerts", "badges"] }
|
|
372
|
+
{ color: "#0ea5e9", usage: ["alerts", "badges"] },
|
|
373
373
|
];
|
|
374
374
|
|
|
375
375
|
// Generate appropriate variables
|
|
@@ -408,13 +408,13 @@ The refactoring tool understands context:
|
|
|
408
408
|
|
|
409
409
|
Understanding match confidence:
|
|
410
410
|
|
|
411
|
-
| Confidence | Meaning
|
|
412
|
-
|
|
413
|
-
| 100%
|
|
414
|
-
| 95-99%
|
|
415
|
-
| 85-94%
|
|
416
|
-
| 70-84%
|
|
417
|
-
| <70%
|
|
411
|
+
| Confidence | Meaning | Action |
|
|
412
|
+
| ---------- | ------------------- | ------------------------- |
|
|
413
|
+
| 100% | Exact match | Auto-replace |
|
|
414
|
+
| 95-99% | Very close (ΔE < 2) | Auto-replace with comment |
|
|
415
|
+
| 85-94% | Close (ΔE < 5) | Suggest replacement |
|
|
416
|
+
| 70-84% | Similar (ΔE < 10) | Manual review |
|
|
417
|
+
| <70% | Different | Keep original |
|
|
418
418
|
|
|
419
419
|
### Handling Edge Cases
|
|
420
420
|
|
|
@@ -632,21 +632,21 @@ Understanding match confidence:
|
|
|
632
632
|
|
|
633
633
|
```javascript
|
|
634
634
|
// refactor-project.js
|
|
635
|
-
const { refactorCSS, generateReport } = require(
|
|
636
|
-
const fs = require(
|
|
637
|
-
const path = require(
|
|
635
|
+
const { refactorCSS, generateReport } = require("coolors-mcp");
|
|
636
|
+
const fs = require("fs");
|
|
637
|
+
const path = require("path");
|
|
638
638
|
|
|
639
639
|
async function refactorProject(srcDir, themeFile) {
|
|
640
|
-
const theme = fs.readFileSync(themeFile,
|
|
640
|
+
const theme = fs.readFileSync(themeFile, "utf-8");
|
|
641
641
|
const cssFiles = findCSSFiles(srcDir);
|
|
642
642
|
const results = [];
|
|
643
643
|
|
|
644
644
|
for (const file of cssFiles) {
|
|
645
|
-
const original = fs.readFileSync(file,
|
|
645
|
+
const original = fs.readFileSync(file, "utf-8");
|
|
646
646
|
const refactored = await refactorCSS(original, theme, {
|
|
647
647
|
minConfidence: 85,
|
|
648
648
|
preserveOriginal: true,
|
|
649
|
-
generateReport: true
|
|
649
|
+
generateReport: true,
|
|
650
650
|
});
|
|
651
651
|
|
|
652
652
|
// Backup original
|
|
@@ -658,7 +658,7 @@ async function refactorProject(srcDir, themeFile) {
|
|
|
658
658
|
results.push({
|
|
659
659
|
file,
|
|
660
660
|
changes: refactored.changes.length,
|
|
661
|
-
confidence: refactored.averageConfidence
|
|
661
|
+
confidence: refactored.averageConfidence,
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
664
|
|
|
@@ -752,12 +752,12 @@ Always verify visual appearance after refactoring:
|
|
|
752
752
|
// Visual regression test
|
|
753
753
|
const screenshots = {
|
|
754
754
|
before: captureScreenshots(originalCSS),
|
|
755
|
-
after: captureScreenshots(refactoredCSS)
|
|
755
|
+
after: captureScreenshots(refactoredCSS),
|
|
756
756
|
};
|
|
757
757
|
|
|
758
758
|
const differences = compareScreenshots(screenshots);
|
|
759
759
|
if (differences.length > 0) {
|
|
760
|
-
console.warn(
|
|
760
|
+
console.warn("Visual differences detected:", differences);
|
|
761
761
|
}
|
|
762
762
|
```
|
|
763
763
|
|
|
@@ -774,9 +774,9 @@ Include documentation with your theme variables:
|
|
|
774
774
|
--color-on-primary: #ffffff;
|
|
775
775
|
|
|
776
776
|
/* Surface colors - ordered by elevation */
|
|
777
|
-
--color-surface-0: #ffffff;
|
|
778
|
-
--color-surface-1: #fafafa;
|
|
779
|
-
--color-surface-2: #f5f5f5;
|
|
777
|
+
--color-surface-0: #ffffff; /* Base level */
|
|
778
|
+
--color-surface-1: #fafafa; /* Slightly elevated */
|
|
779
|
+
--color-surface-2: #f5f5f5; /* More elevated */
|
|
780
780
|
}
|
|
781
781
|
```
|
|
782
782
|
|
|
@@ -788,6 +788,7 @@ Include documentation with your theme variables:
|
|
|
788
788
|
|
|
789
789
|
**Problem**: Most matches have <70% confidence
|
|
790
790
|
**Solution**:
|
|
791
|
+
|
|
791
792
|
- Check if theme has enough color variations
|
|
792
793
|
- Consider adding intermediate shades
|
|
793
794
|
- Use more specific theme variables
|
|
@@ -796,6 +797,7 @@ Include documentation with your theme variables:
|
|
|
796
797
|
|
|
797
798
|
**Problem**: Border colors matching to text variables
|
|
798
799
|
**Solution**:
|
|
800
|
+
|
|
799
801
|
- Use clearer variable naming conventions
|
|
800
802
|
- Provide context parameter when matching
|
|
801
803
|
- Create role-specific variables
|
|
@@ -804,6 +806,7 @@ Include documentation with your theme variables:
|
|
|
804
806
|
|
|
805
807
|
**Problem**: Slow refactoring for large CSS files
|
|
806
808
|
**Solution**:
|
|
809
|
+
|
|
807
810
|
- Split CSS into smaller modules
|
|
808
811
|
- Process files in parallel
|
|
809
812
|
- Cache theme parsing results
|
|
@@ -812,6 +815,7 @@ Include documentation with your theme variables:
|
|
|
812
815
|
|
|
813
816
|
**Problem**: Complex gradients not refactoring correctly
|
|
814
817
|
**Solution**:
|
|
818
|
+
|
|
815
819
|
- Define gradient variables directly
|
|
816
820
|
- Use CSS custom properties for gradient stops
|
|
817
821
|
- Consider keeping complex gradients as-is
|
|
@@ -821,4 +825,4 @@ Include documentation with your theme variables:
|
|
|
821
825
|
- Learn about [Creating Themes](./creating-themes.md) to build comprehensive design systems
|
|
822
826
|
- Explore [Image Extraction](./image-extraction.md) for dynamic theme generation
|
|
823
827
|
- Read [Theme Matching Concepts](../concepts/theme-matching.md) to understand the algorithms
|
|
824
|
-
- Check [Material Design Tools](../tools/material-design.md) for advanced theming
|
|
828
|
+
- Check [Material Design Tools](../tools/material-design.md) for advanced theming
|