sonance-brand-mcp 1.3.68 → 1.3.69

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.
@@ -669,6 +669,53 @@ export async function discoverTheme(projectRoot: string): Promise<DiscoveredThem
669
669
  return result;
670
670
  }
671
671
 
672
+ /**
673
+ * Get a human-readable description of a color based on its luminance and name
674
+ * This helps the LLM understand what colors look like visually
675
+ */
676
+ function getColorDescription(value: string, name: string): string {
677
+ const rgb = parseColorToRgb(value);
678
+ if (!rgb) return "";
679
+
680
+ const luminance = getLuminance(rgb);
681
+ const baseName = name.replace(/^--/, "");
682
+
683
+ // Very light colors (like white)
684
+ if (luminance > 0.9) {
685
+ if (baseName.includes("foreground")) {
686
+ return " (WHITE text)";
687
+ }
688
+ return " ⚠️ WHITE - do NOT use for buttons";
689
+ }
690
+
691
+ // Very dark colors
692
+ if (luminance < 0.1) {
693
+ if (baseName.includes("background")) {
694
+ return " (DARK background)";
695
+ }
696
+ return " (BLACK/DARK)";
697
+ }
698
+
699
+ // Semantic color guidance
700
+ if (baseName.includes("accent")) {
701
+ return " ✓ ACCENT - good for buttons/CTAs";
702
+ }
703
+ if (baseName.includes("success")) {
704
+ return " ✓ GREEN - good for positive actions";
705
+ }
706
+ if (baseName.includes("destructive")) {
707
+ return " ✓ RED - good for danger/delete";
708
+ }
709
+ if (baseName.includes("warning")) {
710
+ return " (ORANGE/YELLOW - caution)";
711
+ }
712
+ if (baseName.includes("primary") && luminance > 0.7) {
713
+ return " ⚠️ LIGHT - avoid for buttons on light backgrounds";
714
+ }
715
+
716
+ return "";
717
+ }
718
+
672
719
  /**
673
720
  * Format discovered theme as context for the LLM prompt
674
721
  * Includes contrast warnings to prevent bad color combinations
@@ -679,9 +726,15 @@ export function formatThemeForPrompt(theme: DiscoveredTheme): string {
679
726
  lines.push("**TARGET CODEBASE THEME (discovered):**");
680
727
  lines.push("");
681
728
 
729
+ // Quick reference for button colors
730
+ lines.push("BUTTON COLOR QUICK REFERENCE:");
731
+ lines.push(" ✓ Use for buttons: bg-accent, bg-success, bg-destructive");
732
+ lines.push(" ✗ Avoid for buttons: bg-primary (may be WHITE), bg-secondary (may be transparent)");
733
+ lines.push("");
734
+
682
735
  // CSS Variables
683
736
  if (Object.keys(theme.cssVariables).length > 0) {
684
- lines.push("CSS Variables:");
737
+ lines.push("COLOR TOKENS (with usage guidance):");
685
738
 
686
739
  // Group by category
687
740
  const categories: Record<string, string[]> = {
@@ -690,7 +743,10 @@ export function formatThemeForPrompt(theme: DiscoveredTheme): string {
690
743
  };
691
744
 
692
745
  for (const [name, value] of Object.entries(theme.cssVariables)) {
693
- const entry = ` ${name}: ${value}`;
746
+ // Add color description for important tokens
747
+ const description = getColorDescription(value, name);
748
+ const entry = ` ${name}: ${value}${description}`;
749
+
694
750
  if (
695
751
  name.includes("background") ||
696
752
  name.includes("foreground") ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.3.68",
3
+ "version": "1.3.69",
4
4
  "description": "MCP Server for Sonance Brand Guidelines and Component Library - gives Claude instant access to brand colors, typography, and UI components.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",