Skip to content

Commit 291b138

Browse files
authored
fix(themes): synchronize github theme accent color between code and docs (JhaSourav07#3174)
## Description Fixes JhaSourav07#2109 Synchronized the GitHub theme accent color between implementation and documentation. The code was using `#39d353` (neon green) while `THEMES.md` documented `#238636` (GitHub's official brand green), creating visual inconsistency between what users read in docs and what got generated. **Why this matters:** - Users reading THEMES.md expected to see `#238636` - Generated badges showed `#39d353` instead - This caused trust issues and confusion **Changes made:** - Updated `lib/svg/themes.ts` — GitHub theme accent: `#39d353` → `#238636` - Verified `THEMES.md` aligns with the new color - Updated available themes count (20 → 24) - Added unit test in `lib/svg/themes.test.ts` to prevent future mismatches - Added integration test in `lib/svg/generator.test.ts` - All 150 tests passing ✅ ## Pillar - [x] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [ ] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview GitHub theme badge now displays with `#238636` accent color (brand green), matching the official documentation. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME&theme=github`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will pass). - [x] My commits follow the Conventional Commits format (`fix(themes): ...`). - [x] I have updated `README.md` if I added a new theme or URL parameter. (Not needed — existing theme updated) - [x] I have started the repo. - [x] I have made sure that I have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents f7ee86e + c0eeced commit 291b138

4 files changed

Lines changed: 37 additions & 2 deletions

File tree

THEMES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CommitPulse Themes
22

3-
All 20 available themes for your CommitPulse badge. Use the `?theme=<slug>` query parameter to apply a theme.
3+
All 24 available themes for your CommitPulse badge. Use the `?theme=<slug>` query parameter to apply a theme.
44

55
```
66
https://commitpulse.vercel.app/api/streak?user=YOUR_USERNAME&theme=<slug>

lib/svg/generator.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,27 @@ describe('generateSVG', () => {
242242
expect(svg).toContain('ffffff'); // default text
243243
});
244244

245+
it('renders correctly with github theme parameters', () => {
246+
const svg = generateSVG(
247+
mockStats,
248+
{
249+
user: 'avi',
250+
bg: themes.github.bg,
251+
text: themes.github.text,
252+
accent: themes.github.accent,
253+
} as unknown as BadgeParams,
254+
mockCalendar
255+
);
256+
257+
assertValidSVG(svg);
258+
// Background fill color
259+
expect(svg).toContain('#0d1117');
260+
// Accent color should be standard brand-consistent #238636
261+
expect(svg).toContain('#238636');
262+
// Text color should be #ffffff
263+
expect(svg).toContain('#ffffff');
264+
});
265+
245266
it('adjusts label styling contrast on light backgrounds versus dark backgrounds', () => {
246267
// 1. Light background (bg: 'ffffff') should use text color for label fill and 0.8 opacity
247268
const svgLight = generateSVG(

lib/svg/themes.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ describe('themes', () => {
116116
});
117117
});
118118

119+
describe('github theme', () => {
120+
it('asserts github theme exists', () => {
121+
expect(themes).toHaveProperty('github');
122+
expect(themes.github).toBeDefined();
123+
});
124+
125+
it('asserts github theme has correct color configuration matching the theme specification', () => {
126+
expect(themes.github.bg).toBe('0d1117');
127+
expect(themes.github.text).toBe('ffffff');
128+
expect(themes.github.accent).toBe('238636');
129+
expect(themes.github.negative).toBe('f85149');
130+
});
131+
});
132+
119133
describe('makeTheme produces HexColor branded types', () => {
120134
const hexRegex = /^[0-9a-f]{6}$/i;
121135

lib/svg/themes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const themes: Record<string, BadgeTheme> = {
1515
dark: makeTheme('0d1117', 'c9d1d9', '58a6ff', 'f85149'),
1616
light: makeTheme('ffffff', '24292f', '0969da', 'cf222e'),
1717
neon: makeTheme('000000', '00ffcc', 'ff00ff', 'ff0055'),
18-
github: makeTheme('0d1117', 'ffffff', '39d353', 'f85149'),
18+
github: makeTheme('0d1117', 'ffffff', '238636', 'f85149'),
1919
dracula: makeTheme('282a36', 'f8f8f2', 'bd93f9', 'ff5555'),
2020
ocean: makeTheme('0a192f', 'ccd6f6', '64ffda', 'ff6b6b'),
2121
sunset: makeTheme('1a0a0a', 'ffd6c0', 'ff6b35', 'ff4d4d'),

0 commit comments

Comments
 (0)