Skip to content

Commit c0eeced

Browse files
committed
fix(themes): synchronize github theme accent color between code and docs
1 parent 2e604a1 commit c0eeced

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)