Skip to content

Commit 52f5e5a

Browse files
author
Miriad
committed
fix: enforce purple #7c3aed in Gemini image generation
Gemini generateContent was ignoring color instructions in prompts. - Prepend CRITICAL COLOR RULE to every prompt before API call - Explicitly ban teal/cyan/green/blue accents - Fix 'purple and teal' in buildInfographicPrompt to 'purple only' - Color enforcement at API boundary, not just in prompt templates
1 parent dc2cc3c commit 52f5e5a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/services/gemini-infographics.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ async function generateWithGeminiContent(
106106
): Promise<{ imageBase64: string; mimeType: string }> {
107107
const ai = getAI();
108108

109+
// Enforce brand colors by prepending strict color instruction
110+
const colorEnforcedPrompt = `CRITICAL COLOR RULE: Use ONLY purple (#7c3aed) for all highlighted elements, fills, accents, and glows. Use ONLY white (#FFFFFF) for text, arrows, and lines. Use ONLY black (#000000) for background. NEVER use teal, cyan, green, blue, or any other accent color.\n\n${prompt}`;
111+
109112
const response = await ai.models.generateContent({
110113
model,
111-
contents: prompt,
114+
contents: colorEnforcedPrompt,
112115
config: {
113116
responseModalities: ['IMAGE', 'TEXT'],
114117
thinkingConfig: {
@@ -277,8 +280,8 @@ export function buildInfographicPrompt(
277280
): string {
278281
return (
279282
`Create a professional, visually striking infographic about: ${topic}. ` +
280-
`Style: ${style}, purple and teal accent colors, clean sans-serif typography, ` +
281-
`CodingCat.dev brand aesthetic. ` +
283+
`Style: ${style}, purple (#7c3aed) accent colors ONLY on black (#000000) background, clean sans-serif typography, ` +
284+
`CodingCat.dev brand aesthetic. NO teal, NO cyan, NO green accents. ` +
282285
`Layout: structured sections with icons, data visualizations, and clear hierarchy. ` +
283286
`No watermarks. High information density. Developer audience.`
284287
);

0 commit comments

Comments
 (0)