Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(branding): remove JS-heuristic fallback for secondary color when LLM omits it

firecrawl-spring[bot]ae6d300da437
diff --git a/apps/api/src/lib/branding/merge.ts b/apps/api/src/lib/branding/merge.ts
index 6d79d5737..59ac5854c 100644
--- a/apps/api/src/lib/branding/merge.ts
+++ b/apps/api/src/lib/branding/merge.ts
@@ -269,14 +269,18 @@ export function mergeBrandingResults(
primary: llm.colorRoles.primaryColor || merged.colors?.primary,
...(llm.colorRoles.secondaryColor
? { secondary: llm.colorRoles.secondaryColor }
- : merged.colors?.secondary
- ? { secondary: merged.colors.secondary }
- : {}),
+ : {}),
accent: llm.colorRoles.accentColor || merged.colors?.accent,
background: llm.colorRoles.backgroundColor || merged.colors?.background,
textPrimary: llm.colorRoles.textPrimary || merged.colors?.textPrimary,
};
+ // When the LLM omits secondaryColor, remove the JS-heuristic secondary
+ // to avoid propagating spurious colors from CSS presets (e.g. WordPress themes)
+ if (!llm.colorRoles.secondaryColor && merged.colors?.secondary) {
+ delete merged.colors.secondary;
+ }
+
// Add LLM-selected colors to debug output
if ((merged as any).__debug_colors) {
(merged as any).__debug_colors.llmSelectedColors = {