Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ export default function Home() {
);
}

const TAGS = [{ label: "hair" }, { label: "fire" }];
const TAGS = [{ label: "hair" }, { label: "fire" }, { label: "plant" }];
17 changes: 16 additions & 1 deletion lib/svg-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export async function generateThemedSVG(username: string, themeKey: string) {
const cellSize = 14;

const background = theme.background || "#ffffff";
const backgroundPattern = theme.backgroundPattern;
const patternId = `pattern_${themeKey}`;

const baseDot = theme.showBaseDot ?? false;

const elements = weeks.flatMap((week, weekIndex) =>
Expand Down Expand Up @@ -44,9 +47,21 @@ export async function generateThemedSVG(username: string, themeKey: string) {
}),
);

const defs = backgroundPattern
? `<defs>${backgroundPattern.replace(
/<pattern([^>]*)>/,
`<pattern id="${patternId}"$1>`
)}</defs>`
: "";

const fillValue = backgroundPattern ? `url(#${patternId})` : background;
console.log("defs:", defs);
console.log("fillValue:", fillValue);

const svg = `
<svg xmlns="http://www.w3.org/2000/svg" width="${weeks.length * cellSize + 40}" height="180">
<rect width="100%" height="100%" fill="${background}" />
${defs}
<rect width="100%" height="100%" fill="${fillValue}" />
<text x="20" y="30" font-size="16" fill="#333">${theme.emoji || ""} ${username}'s ${theme.label}</text>
${elements.join("\n")}
</svg>
Expand Down
46 changes: 46 additions & 0 deletions lib/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ThemeStyle {
label: string;
emoji?: string;
background?: string;
backgroundPattern?: string;
showBaseDot?: boolean;
}

Expand Down Expand Up @@ -61,9 +62,54 @@ export const FireTheme: ThemeStyle = {
},
};

export const PlantTheme: ThemeStyle = {
label: "Plant",
emoji: "🌿",
background: "#f0fdf4",
backgroundPattern: `
<pattern patternUnits="userSpaceOnUse" width="40" height="40">
<rect width="40" height="40" fill="#7B4A22" />
<ellipse cx="8.2" cy="7.1" rx="5.1" ry="2.2" fill="#A97C50" opacity="0.65"/>
<ellipse cx="30.5" cy="15.7" rx="3.8" ry="2.9" fill="#C69C6D" opacity="0.55"/>
<ellipse cx="20.1" cy="35.2" rx="4.2" ry="1.7" fill="#8D6748" opacity="0.60"/>
<ellipse cx="12.7" cy="28.3" rx="2.9" ry="1.2" fill="#BCA17A" opacity="0.70"/>
<circle cx="5.2" cy="5.8" r="1.7" fill="#F9E4B7" opacity="0.80"/>
<circle cx="13.1" cy="11.2" r="1.1" fill="#F6D28B" opacity="0.60"/>
<circle cx="32.3" cy="8.4" r="1.3" fill="#F9E4B7" opacity="0.90"/>
<circle cx="18.7" cy="25.6" r="1.2" fill="#BCA17A" opacity="0.70"/>
<circle cx="36.2" cy="36.1" r="1.5" fill="#A97C50" opacity="0.80"/>
</pattern>
`,
showBaseDot: true,
getEmoji: (level: CommitLevel): string | null => {
switch (level) {
case "none":
return null;
case "low":
return "🫘"; // 씨앗
case "medium":
return "🌱"; // μƒˆμ‹Ή
case "high":
return "🌿"; // ν’€μžŽ
case "max":
return "🌻"; // 꽃
default:
return null;
}
},
colorMap: {
none: "#f0fdf4",
low: "#bbf7d0",
medium: "#86efac",
high: "#4ade80",
max: "#f472b6",
},
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

색상 λ§€ν•‘μ—μ„œ 일관성 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€.

max 레벨의 색상이 #f472b6 (뢄홍색)으둜 μ„€μ •λ˜μ–΄ μžˆμ–΄ λ‹€λ₯Έ 녹색 계열 색상듀과 일관성이 λ–¨μ–΄μ§‘λ‹ˆλ‹€. 식물 ν…Œλ§ˆμ— 더 μ ν•©ν•œ 색상을 κ³ λ €ν•΄λ³΄μ„Έμš”.

λ‹€μŒκ³Ό 같이 μˆ˜μ •μ„ μ œμ•ˆν•©λ‹ˆλ‹€:

	colorMap: {
		none: "#f0fdf4",
		low: "#bbf7d0",
		medium: "#86efac",
		high: "#4ade80",
-		max: "#f472b6",
+		max: "#16a34a", // 더 μ§„ν•œ 녹색 λ˜λŠ” ν™©κΈˆμƒ‰ "#fbbf24"
	},
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
colorMap: {
none: "#f0fdf4",
low: "#bbf7d0",
medium: "#86efac",
high: "#4ade80",
max: "#f472b6",
},
};
colorMap: {
none: "#f0fdf4",
low: "#bbf7d0",
medium: "#86efac",
high: "#4ade80",
max: "#16a34a", // 더 μ§„ν•œ 녹색 λ˜λŠ” ν™©κΈˆμƒ‰ "#fbbf24"
},
};
πŸ€– Prompt for AI Agents
In lib/themes.ts around lines 100 to 107, the color assigned to the 'max' level
in the colorMap is inconsistent with the other green shades, as it is currently
set to a pink color (#f472b6). To fix this, replace the 'max' color value with a
green shade that aligns with the existing green palette to maintain theme
consistency.


export const themes: Record<string, ThemeStyle> = {
hair: HairTheme,
fire: FireTheme,
plant: PlantTheme,
};

export function getCommitLevel(commitCount: number): CommitLevel {
Expand Down