@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
|
@@ -8,7 +8,7 @@ Learn how to create comprehensive color themes using Material Design 3 principle
|
|
|
8
8
|
|
|
9
9
|
```javascript
|
|
10
10
|
// Create a complete theme from one color
|
|
11
|
-
"Generate a Material Design theme from #6366f1"
|
|
11
|
+
"Generate a Material Design theme from #6366f1";
|
|
12
12
|
|
|
13
13
|
// Result: Complete light and dark schemes with:
|
|
14
14
|
// - Primary, secondary, tertiary, neutral, error palettes
|
|
@@ -21,7 +21,7 @@ Learn how to create comprehensive color themes using Material Design 3 principle
|
|
|
21
21
|
|
|
22
22
|
```javascript
|
|
23
23
|
// Extract colors and create theme
|
|
24
|
-
"Generate a theme from this logo image"
|
|
24
|
+
"Generate a theme from this logo image";
|
|
25
25
|
|
|
26
26
|
// Process:
|
|
27
27
|
// 1. Extracts dominant colors using Celebi algorithm
|
|
@@ -119,9 +119,9 @@ const theme = generateMaterialTheme({
|
|
|
119
119
|
```javascript
|
|
120
120
|
// Professional dashboard colors
|
|
121
121
|
const dashboardTheme = {
|
|
122
|
-
sourceColor: "#2563eb",
|
|
123
|
-
variant: "neutral",
|
|
124
|
-
contrastLevel: 0
|
|
122
|
+
sourceColor: "#2563eb", // Blue
|
|
123
|
+
variant: "neutral", // Minimal color variation
|
|
124
|
+
contrastLevel: 0, // Standard contrast
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
// Generated theme emphasizes:
|
|
@@ -151,8 +151,8 @@ const result = {
|
|
|
151
151
|
success: "#10b981",
|
|
152
152
|
warning: "#f59e0b",
|
|
153
153
|
error: "#ef4444",
|
|
154
|
-
info: "#3b82f6"
|
|
155
|
-
}
|
|
154
|
+
info: "#3b82f6",
|
|
155
|
+
},
|
|
156
156
|
};
|
|
157
157
|
```
|
|
158
158
|
|
|
@@ -161,9 +161,9 @@ const result = {
|
|
|
161
161
|
```javascript
|
|
162
162
|
// Vibrant shopping experience
|
|
163
163
|
const ecommerceTheme = {
|
|
164
|
-
sourceColor: "#ec4899",
|
|
165
|
-
variant: "vibrant",
|
|
166
|
-
contrastLevel: 0.5
|
|
164
|
+
sourceColor: "#ec4899", // Pink
|
|
165
|
+
variant: "vibrant", // Higher chroma
|
|
166
|
+
contrastLevel: 0.5, // Medium contrast
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
// Features:
|
|
@@ -188,8 +188,8 @@ const shopTheme = {
|
|
|
188
188
|
|
|
189
189
|
// Reviews
|
|
190
190
|
starActive: "#f59e0b",
|
|
191
|
-
starInactive: "#e5e7eb"
|
|
192
|
-
}
|
|
191
|
+
starInactive: "#e5e7eb",
|
|
192
|
+
},
|
|
193
193
|
};
|
|
194
194
|
```
|
|
195
195
|
|
|
@@ -204,8 +204,8 @@ async function createMusicTheme(albumArtUrl) {
|
|
|
204
204
|
// Generate theme from dominant color
|
|
205
205
|
const theme = await generateThemeFromImage({
|
|
206
206
|
imageData: imageColors,
|
|
207
|
-
variant: "expressive",
|
|
208
|
-
contrastLevel: 0
|
|
207
|
+
variant: "expressive", // Creative combinations
|
|
208
|
+
contrastLevel: 0,
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
return {
|
|
@@ -225,11 +225,7 @@ async function createMusicTheme(albumArtUrl) {
|
|
|
225
225
|
songTitle: theme.dark.onSurfaceVariant,
|
|
226
226
|
|
|
227
227
|
// Visualizer colors
|
|
228
|
-
visualizer: [
|
|
229
|
-
theme.dark.primary,
|
|
230
|
-
theme.dark.secondary,
|
|
231
|
-
theme.dark.tertiary
|
|
232
|
-
]
|
|
228
|
+
visualizer: [theme.dark.primary, theme.dark.secondary, theme.dark.tertiary],
|
|
233
229
|
};
|
|
234
230
|
}
|
|
235
231
|
```
|
|
@@ -253,7 +249,7 @@ const designSystem = {
|
|
|
253
249
|
action: {
|
|
254
250
|
primary: "#6366f1",
|
|
255
251
|
secondary: "#8b92ff",
|
|
256
|
-
disabled: "#c7c7c7"
|
|
252
|
+
disabled: "#c7c7c7",
|
|
257
253
|
},
|
|
258
254
|
|
|
259
255
|
// Feedback
|
|
@@ -261,7 +257,7 @@ const designSystem = {
|
|
|
261
257
|
success: "#10b981",
|
|
262
258
|
warning: "#f59e0b",
|
|
263
259
|
error: "#ef4444",
|
|
264
|
-
info: "#3b82f6"
|
|
260
|
+
info: "#3b82f6",
|
|
265
261
|
},
|
|
266
262
|
|
|
267
263
|
// Content
|
|
@@ -269,8 +265,8 @@ const designSystem = {
|
|
|
269
265
|
primary: "#1f2937",
|
|
270
266
|
secondary: "#4b5563",
|
|
271
267
|
disabled: "#9ca3af",
|
|
272
|
-
inverse: "#ffffff"
|
|
273
|
-
}
|
|
268
|
+
inverse: "#ffffff",
|
|
269
|
+
},
|
|
274
270
|
},
|
|
275
271
|
|
|
276
272
|
// Component tokens
|
|
@@ -280,14 +276,14 @@ const designSystem = {
|
|
|
280
276
|
bg: "palette.primary.500",
|
|
281
277
|
text: "white",
|
|
282
278
|
hover: "palette.primary.600",
|
|
283
|
-
active: "palette.primary.700"
|
|
279
|
+
active: "palette.primary.700",
|
|
284
280
|
},
|
|
285
281
|
secondary: {
|
|
286
282
|
bg: "palette.primary.100",
|
|
287
283
|
text: "palette.primary.700",
|
|
288
284
|
hover: "palette.primary.200",
|
|
289
|
-
active: "palette.primary.300"
|
|
290
|
-
}
|
|
285
|
+
active: "palette.primary.300",
|
|
286
|
+
},
|
|
291
287
|
},
|
|
292
288
|
|
|
293
289
|
input: {
|
|
@@ -295,15 +291,15 @@ const designSystem = {
|
|
|
295
291
|
border: "palette.neutral.300",
|
|
296
292
|
text: "content.primary",
|
|
297
293
|
placeholder: "content.secondary",
|
|
298
|
-
focus: "palette.primary.500"
|
|
294
|
+
focus: "palette.primary.500",
|
|
299
295
|
},
|
|
300
296
|
|
|
301
297
|
card: {
|
|
302
298
|
bg: "white",
|
|
303
299
|
border: "palette.neutral.200",
|
|
304
|
-
shadow: "0 1px 3px rgba(0,0,0,0.1)"
|
|
305
|
-
}
|
|
306
|
-
}
|
|
300
|
+
shadow: "0 1px 3px rgba(0,0,0,0.1)",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
307
303
|
};
|
|
308
304
|
```
|
|
309
305
|
|
|
@@ -371,19 +367,19 @@ Adjust contrast for accessibility needs:
|
|
|
371
367
|
// Standard contrast (WCAG AA)
|
|
372
368
|
const standard = {
|
|
373
369
|
sourceColor: "#6366f1",
|
|
374
|
-
contrastLevel: 0
|
|
370
|
+
contrastLevel: 0, // Default
|
|
375
371
|
};
|
|
376
372
|
|
|
377
373
|
// Medium contrast (Between AA and AAA)
|
|
378
374
|
const medium = {
|
|
379
375
|
sourceColor: "#6366f1",
|
|
380
|
-
contrastLevel: 0.5
|
|
376
|
+
contrastLevel: 0.5,
|
|
381
377
|
};
|
|
382
378
|
|
|
383
379
|
// High contrast (WCAG AAA)
|
|
384
380
|
const high = {
|
|
385
381
|
sourceColor: "#6366f1",
|
|
386
|
-
contrastLevel: 1.0
|
|
382
|
+
contrastLevel: 1.0,
|
|
387
383
|
};
|
|
388
384
|
|
|
389
385
|
// Results in different tone mappings:
|
|
@@ -401,15 +397,15 @@ const high = {
|
|
|
401
397
|
function createUserTheme(preferences) {
|
|
402
398
|
const {
|
|
403
399
|
favoriteColor,
|
|
404
|
-
contrastNeeds,
|
|
405
|
-
colorBlindness,
|
|
406
|
-
darkMode
|
|
400
|
+
contrastNeeds, // "normal", "high", "maximum"
|
|
401
|
+
colorBlindness, // null, "protanopia", "deuteranopia", etc.
|
|
402
|
+
darkMode,
|
|
407
403
|
} = preferences;
|
|
408
404
|
|
|
409
405
|
// Base theme
|
|
410
406
|
let theme = generateMaterialTheme({
|
|
411
407
|
sourceColor: favoriteColor,
|
|
412
|
-
contrastLevel: contrastNeeds === "high" ? 1.0 : 0
|
|
408
|
+
contrastLevel: contrastNeeds === "high" ? 1.0 : 0,
|
|
413
409
|
});
|
|
414
410
|
|
|
415
411
|
// Adjust for color blindness
|
|
@@ -434,28 +430,28 @@ function getTimeBasedTheme() {
|
|
|
434
430
|
return {
|
|
435
431
|
sourceColor: "#1a1a2e",
|
|
436
432
|
variant: "monochrome",
|
|
437
|
-
scheme: "dark"
|
|
433
|
+
scheme: "dark",
|
|
438
434
|
};
|
|
439
435
|
} else if (hour < 12) {
|
|
440
436
|
// Morning theme (bright, energetic)
|
|
441
437
|
return {
|
|
442
438
|
sourceColor: "#fbbf24",
|
|
443
439
|
variant: "vibrant",
|
|
444
|
-
scheme: "light"
|
|
440
|
+
scheme: "light",
|
|
445
441
|
};
|
|
446
442
|
} else if (hour < 18) {
|
|
447
443
|
// Afternoon theme (balanced)
|
|
448
444
|
return {
|
|
449
445
|
sourceColor: "#3b82f6",
|
|
450
446
|
variant: "tonalSpot",
|
|
451
|
-
scheme: "light"
|
|
447
|
+
scheme: "light",
|
|
452
448
|
};
|
|
453
449
|
} else {
|
|
454
450
|
// Evening theme (warm, relaxed)
|
|
455
451
|
return {
|
|
456
452
|
sourceColor: "#f97316",
|
|
457
453
|
variant: "neutral",
|
|
458
|
-
scheme: "dark"
|
|
454
|
+
scheme: "dark",
|
|
459
455
|
};
|
|
460
456
|
}
|
|
461
457
|
}
|
|
@@ -467,31 +463,31 @@ function getTimeBasedTheme() {
|
|
|
467
463
|
// Generate theme based on content
|
|
468
464
|
async function createContentTheme(contentType, contentData) {
|
|
469
465
|
switch (contentType) {
|
|
470
|
-
case
|
|
466
|
+
case "article":
|
|
471
467
|
// Clean, readable theme
|
|
472
468
|
return {
|
|
473
469
|
sourceColor: "#1f2937",
|
|
474
470
|
variant: "neutral",
|
|
475
|
-
contrastLevel: 0.5
|
|
471
|
+
contrastLevel: 0.5,
|
|
476
472
|
};
|
|
477
473
|
|
|
478
|
-
case
|
|
474
|
+
case "gallery":
|
|
479
475
|
// Let images stand out
|
|
480
476
|
return {
|
|
481
477
|
sourceColor: contentData.dominantColor,
|
|
482
478
|
variant: "monochrome",
|
|
483
|
-
scheme: "dark"
|
|
479
|
+
scheme: "dark",
|
|
484
480
|
};
|
|
485
481
|
|
|
486
|
-
case
|
|
482
|
+
case "video":
|
|
487
483
|
// Dark, immersive theme
|
|
488
484
|
return {
|
|
489
485
|
sourceColor: "#0f172a",
|
|
490
486
|
variant: "monochrome",
|
|
491
|
-
scheme: "dark"
|
|
487
|
+
scheme: "dark",
|
|
492
488
|
};
|
|
493
489
|
|
|
494
|
-
case
|
|
490
|
+
case "product":
|
|
495
491
|
// Match product color
|
|
496
492
|
return generateThemeFromImage(contentData.productImage);
|
|
497
493
|
}
|
|
@@ -559,16 +555,16 @@ function generateTailwindConfig(theme) {
|
|
|
559
555
|
700: theme.palettes.primary[30],
|
|
560
556
|
800: theme.palettes.primary[20],
|
|
561
557
|
900: theme.palettes.primary[10],
|
|
562
|
-
950: theme.palettes.primary[0]
|
|
558
|
+
950: theme.palettes.primary[0],
|
|
563
559
|
},
|
|
564
560
|
surface: {
|
|
565
561
|
DEFAULT: theme.surface,
|
|
566
562
|
container: theme.surfaceContainer,
|
|
567
|
-
variant: theme.surfaceVariant
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
563
|
+
variant: theme.surfaceVariant,
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
},
|
|
572
568
|
};
|
|
573
569
|
}
|
|
574
570
|
```
|
|
@@ -583,11 +579,11 @@ $theme-primary-container: #e0e0ff;
|
|
|
583
579
|
$theme-on-primary-container: #070764;
|
|
584
580
|
|
|
585
581
|
// Mixin for component theming
|
|
586
|
-
@mixin apply-theme($role:
|
|
587
|
-
@if $role ==
|
|
582
|
+
@mixin apply-theme($role: "surface") {
|
|
583
|
+
@if $role == "primary" {
|
|
588
584
|
background: $theme-primary;
|
|
589
585
|
color: $theme-on-primary;
|
|
590
|
-
} @else if $role ==
|
|
586
|
+
} @else if $role == "primary-container" {
|
|
591
587
|
background: $theme-primary-container;
|
|
592
588
|
color: $theme-on-primary-container;
|
|
593
589
|
}
|
|
@@ -595,7 +591,7 @@ $theme-on-primary-container: #070764;
|
|
|
595
591
|
|
|
596
592
|
// Usage
|
|
597
593
|
.button-primary {
|
|
598
|
-
@include apply-theme(
|
|
594
|
+
@include apply-theme("primary");
|
|
599
595
|
}
|
|
600
596
|
```
|
|
601
597
|
|
|
@@ -614,21 +610,21 @@ function validateThemeAccessibility(theme) {
|
|
|
614
610
|
|
|
615
611
|
// Interactive elements
|
|
616
612
|
{ fg: theme.primary, bg: theme.surface, min: 3.0 },
|
|
617
|
-
{ fg: theme.outline, bg: theme.surface, min: 3.0 }
|
|
613
|
+
{ fg: theme.outline, bg: theme.surface, min: 3.0 },
|
|
618
614
|
];
|
|
619
615
|
|
|
620
|
-
const results = checks.map(check => {
|
|
616
|
+
const results = checks.map((check) => {
|
|
621
617
|
const ratio = checkContrast(check.fg, check.bg);
|
|
622
618
|
return {
|
|
623
619
|
...check,
|
|
624
620
|
ratio,
|
|
625
|
-
passes: ratio >= check.min
|
|
621
|
+
passes: ratio >= check.min,
|
|
626
622
|
};
|
|
627
623
|
});
|
|
628
624
|
|
|
629
625
|
return {
|
|
630
|
-
allPass: results.every(r => r.passes),
|
|
631
|
-
failures: results.filter(r => !r.passes)
|
|
626
|
+
allPass: results.every((r) => r.passes),
|
|
627
|
+
failures: results.filter((r) => !r.passes),
|
|
632
628
|
};
|
|
633
629
|
}
|
|
634
630
|
```
|
|
@@ -654,7 +650,7 @@ function createHighContrastTheme(baseTheme) {
|
|
|
654
650
|
|
|
655
651
|
// Remove subtle variations
|
|
656
652
|
surfaceVariant: "#ffffff",
|
|
657
|
-
surfaceContainer: "#ffffff"
|
|
653
|
+
surfaceContainer: "#ffffff",
|
|
658
654
|
};
|
|
659
655
|
}
|
|
660
656
|
```
|
|
@@ -665,19 +661,19 @@ function createHighContrastTheme(baseTheme) {
|
|
|
665
661
|
// Adjust theme for color blindness
|
|
666
662
|
function adjustForColorBlindness(theme, type) {
|
|
667
663
|
switch (type) {
|
|
668
|
-
case
|
|
664
|
+
case "protanopia": // Red-blind
|
|
669
665
|
// Shift reds toward blue
|
|
670
|
-
return shiftProblemColors(theme, [
|
|
666
|
+
return shiftProblemColors(theme, ["red"], "blue");
|
|
671
667
|
|
|
672
|
-
case
|
|
668
|
+
case "deuteranopia": // Green-blind
|
|
673
669
|
// Enhance red-blue distinction
|
|
674
|
-
return enhanceColorDistinction(theme, [
|
|
670
|
+
return enhanceColorDistinction(theme, ["red", "blue"]);
|
|
675
671
|
|
|
676
|
-
case
|
|
672
|
+
case "tritanopia": // Blue-blind
|
|
677
673
|
// Use red-green distinction
|
|
678
|
-
return shiftProblemColors(theme, [
|
|
674
|
+
return shiftProblemColors(theme, ["blue"], "green");
|
|
679
675
|
|
|
680
|
-
case
|
|
676
|
+
case "achromatopsia": // Total color blindness
|
|
681
677
|
// Use only lightness variations
|
|
682
678
|
return createMonochromeTheme(theme);
|
|
683
679
|
}
|
|
@@ -692,9 +688,9 @@ function adjustForColorBlindness(theme, type) {
|
|
|
692
688
|
// Serious, trustworthy appearance
|
|
693
689
|
const newsTheme = {
|
|
694
690
|
// Core colors
|
|
695
|
-
primary: "#1e40af",
|
|
696
|
-
secondary: "#dc2626",
|
|
697
|
-
neutral: "#1f2937",
|
|
691
|
+
primary: "#1e40af", // Deep blue
|
|
692
|
+
secondary: "#dc2626", // Breaking news red
|
|
693
|
+
neutral: "#1f2937", // Text
|
|
698
694
|
|
|
699
695
|
// Sections
|
|
700
696
|
politics: "#1e40af",
|
|
@@ -711,7 +707,7 @@ const newsTheme = {
|
|
|
711
707
|
// Typography
|
|
712
708
|
headline: "#111827",
|
|
713
709
|
body: "#374151",
|
|
714
|
-
caption: "#6b7280"
|
|
710
|
+
caption: "#6b7280",
|
|
715
711
|
};
|
|
716
712
|
```
|
|
717
713
|
|
|
@@ -720,13 +716,13 @@ const newsTheme = {
|
|
|
720
716
|
```javascript
|
|
721
717
|
// Friendly, engaging theme
|
|
722
718
|
const socialTheme = generateMaterialTheme({
|
|
723
|
-
sourceColor: "#3b82f6",
|
|
719
|
+
sourceColor: "#3b82f6", // Facebook-like blue
|
|
724
720
|
customColors: [
|
|
725
|
-
{ name: "like", color: "#ef4444" },
|
|
726
|
-
{ name: "share", color: "#10b981" },
|
|
727
|
-
{ name: "comment", color: "#6366f1" }
|
|
721
|
+
{ name: "like", color: "#ef4444" }, // Red heart
|
|
722
|
+
{ name: "share", color: "#10b981" }, // Green share
|
|
723
|
+
{ name: "comment", color: "#6366f1" }, // Blue comment
|
|
728
724
|
],
|
|
729
|
-
variant: "vibrant"
|
|
725
|
+
variant: "vibrant",
|
|
730
726
|
});
|
|
731
727
|
|
|
732
728
|
// Additional social elements
|
|
@@ -742,7 +738,7 @@ const socialElements = {
|
|
|
742
738
|
// Status indicators
|
|
743
739
|
online: "#10b981",
|
|
744
740
|
away: "#f59e0b",
|
|
745
|
-
offline: "#6b7280"
|
|
741
|
+
offline: "#6b7280",
|
|
746
742
|
};
|
|
747
743
|
```
|
|
748
744
|
|
|
@@ -752,11 +748,11 @@ const socialElements = {
|
|
|
752
748
|
// Clear, focused learning environment
|
|
753
749
|
const eduTheme = {
|
|
754
750
|
// Subject colors
|
|
755
|
-
math: "#3b82f6",
|
|
756
|
-
science: "#10b981",
|
|
751
|
+
math: "#3b82f6", // Blue
|
|
752
|
+
science: "#10b981", // Green
|
|
757
753
|
literature: "#8b5cf6", // Purple
|
|
758
|
-
history: "#f59e0b",
|
|
759
|
-
arts: "#ec4899",
|
|
754
|
+
history: "#f59e0b", // Amber
|
|
755
|
+
arts: "#ec4899", // Pink
|
|
760
756
|
|
|
761
757
|
// Progress indicators
|
|
762
758
|
notStarted: "#e5e7eb",
|
|
@@ -767,7 +763,7 @@ const eduTheme = {
|
|
|
767
763
|
beginner: "#10b981",
|
|
768
764
|
intermediate: "#3b82f6",
|
|
769
765
|
advanced: "#7c3aed",
|
|
770
|
-
expert: "#dc2626"
|
|
766
|
+
expert: "#dc2626",
|
|
771
767
|
};
|
|
772
768
|
```
|
|
773
769
|
|
|
@@ -785,21 +781,21 @@ function previewTheme(theme) {
|
|
|
785
781
|
color,
|
|
786
782
|
hex: color,
|
|
787
783
|
rgb: hexToRgb(color),
|
|
788
|
-
hsl: hexToHsl(color)
|
|
784
|
+
hsl: hexToHsl(color),
|
|
789
785
|
})),
|
|
790
786
|
|
|
791
787
|
// Sample components
|
|
792
788
|
components: {
|
|
793
789
|
button: generateButtonPreview(theme),
|
|
794
790
|
card: generateCardPreview(theme),
|
|
795
|
-
form: generateFormPreview(theme)
|
|
791
|
+
form: generateFormPreview(theme),
|
|
796
792
|
},
|
|
797
793
|
|
|
798
794
|
// Accessibility report
|
|
799
795
|
accessibility: validateThemeAccessibility(theme),
|
|
800
796
|
|
|
801
797
|
// Color harmony analysis
|
|
802
|
-
harmony: analyzeColorHarmony(theme)
|
|
798
|
+
harmony: analyzeColorHarmony(theme),
|
|
803
799
|
};
|
|
804
800
|
|
|
805
801
|
return preview;
|
|
@@ -810,23 +806,23 @@ function previewTheme(theme) {
|
|
|
810
806
|
|
|
811
807
|
```javascript
|
|
812
808
|
// Test theme generation
|
|
813
|
-
describe(
|
|
814
|
-
test(
|
|
815
|
-
const theme = generateMaterialTheme(
|
|
809
|
+
describe("Theme Creation", () => {
|
|
810
|
+
test("generates accessible color pairs", () => {
|
|
811
|
+
const theme = generateMaterialTheme("#6366f1");
|
|
816
812
|
|
|
817
813
|
// Check primary colors
|
|
818
814
|
const ratio = getContrast(
|
|
819
815
|
theme.schemes.light.primary,
|
|
820
|
-
theme.schemes.light.onPrimary
|
|
816
|
+
theme.schemes.light.onPrimary,
|
|
821
817
|
);
|
|
822
818
|
expect(ratio).toBeGreaterThanOrEqual(4.5);
|
|
823
819
|
});
|
|
824
820
|
|
|
825
|
-
test(
|
|
826
|
-
const brand =
|
|
821
|
+
test("maintains brand color fidelity", () => {
|
|
822
|
+
const brand = "#ff5722";
|
|
827
823
|
const theme = generateMaterialTheme({
|
|
828
824
|
sourceColor: brand,
|
|
829
|
-
variant:
|
|
825
|
+
variant: "fidelity",
|
|
830
826
|
});
|
|
831
827
|
|
|
832
828
|
const distance = colorDistance(brand, theme.schemes.light.primary);
|
|
@@ -850,11 +846,11 @@ const themeJson = {
|
|
|
850
846
|
created: new Date().toISOString(),
|
|
851
847
|
sourceColor: "#6366f1",
|
|
852
848
|
variant: "tonalSpot",
|
|
853
|
-
contrastLevel: 0
|
|
854
|
-
}
|
|
849
|
+
contrastLevel: 0,
|
|
850
|
+
},
|
|
855
851
|
};
|
|
856
852
|
|
|
857
|
-
fs.writeFileSync(
|
|
853
|
+
fs.writeFileSync("theme.json", JSON.stringify(themeJson, null, 2));
|
|
858
854
|
```
|
|
859
855
|
|
|
860
856
|
### Design Tokens
|
|
@@ -865,28 +861,28 @@ const tokens = {
|
|
|
865
861
|
color: {
|
|
866
862
|
primary: {
|
|
867
863
|
value: theme.primary,
|
|
868
|
-
type: "color"
|
|
864
|
+
type: "color",
|
|
869
865
|
},
|
|
870
866
|
onPrimary: {
|
|
871
867
|
value: theme.onPrimary,
|
|
872
|
-
type: "color"
|
|
873
|
-
}
|
|
868
|
+
type: "color",
|
|
869
|
+
},
|
|
874
870
|
},
|
|
875
871
|
spacing: {
|
|
876
872
|
small: { value: "8px", type: "dimension" },
|
|
877
873
|
medium: { value: "16px", type: "dimension" },
|
|
878
|
-
large: { value: "24px", type: "dimension" }
|
|
874
|
+
large: { value: "24px", type: "dimension" },
|
|
879
875
|
},
|
|
880
876
|
typography: {
|
|
881
877
|
heading: {
|
|
882
878
|
value: {
|
|
883
879
|
fontFamily: "Inter",
|
|
884
880
|
fontSize: "24px",
|
|
885
|
-
fontWeight: 600
|
|
881
|
+
fontWeight: 600,
|
|
886
882
|
},
|
|
887
|
-
type: "typography"
|
|
888
|
-
}
|
|
889
|
-
}
|
|
883
|
+
type: "typography",
|
|
884
|
+
},
|
|
885
|
+
},
|
|
890
886
|
};
|
|
891
887
|
```
|
|
892
888
|
|
|
@@ -895,4 +891,4 @@ const tokens = {
|
|
|
895
891
|
- Explore [Image Extraction](./image-extraction.md) for dynamic theme generation
|
|
896
892
|
- Learn about [CSS Refactoring](./css-refactoring.md) to apply themes
|
|
897
893
|
- Read [Material Design Concepts](../concepts/material-design.md) for theory
|
|
898
|
-
- Check [Theme Matching Tools](../tools/theme-matching.md) for implementation
|
|
894
|
+
- Check [Theme Matching Tools](../tools/theme-matching.md) for implementation
|