Skip to content

Commit f89d184

Browse files
authored
Refactor: rename auto theme aliases (JhaSourav07#589)
## Description Fixes JhaSourav07#357 Refactored the auto theme alias naming for better clarity and consistency across the SVG theme generation logic. ## Pillar * [ ] 🎨 Pillar 1 β€” New Theme Design * [ ] πŸ“ Pillar 2 β€” Geometric SVG Improvement * [ ] πŸ• Pillar 3 β€” Timezone Logic Optimization * [x] πŸ› οΈ Other (Bug fix, refactoring, docs) ### Changes made * Renamed 'AUTO_LIGHT_THEME' to 'AUTO_THEME_LIGHT' * Renamed 'AUTO_DARK_THEME' to 'AUTO_THEME_DARK' * Verified there are no leftover references to old aliases ## Visual Preview N/A β€” This PR only includes internal constant renaming/refactoring changes. ## 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=Harshitbhardwaj468'). * [x] I have run 'npm run format' and 'npm run lint' locally and resolved all errors (CI will fail otherwise). * [x] My commits follow the Conventional Commits format (e.g., 'feat(themes): ...', 'fix(calculate): ...'). * [ ] I have updated 'README.md' if I added a new theme or URL parameter. * [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 server for faster collaboration, mentorship, and PR support.
2 parents d02f026 + 7116847 commit f89d184

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

β€Žlib/svg/generator.tsβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BadgeParams, ContributionCalendar, StreakStats, MonthlyStats } from '../../types';
22
import { getLabels, type BadgeLabels } from '../i18n/badgeLabels';
3-
import { AUTO_DARK_THEME, AUTO_LIGHT_THEME } from './themes';
3+
import { AUTO_THEME_DARK, AUTO_THEME_LIGHT } from './themes';
44
import { TOWER_ANIMATION_CSS } from './animations';
55
import { computeTowers, type TowerData } from './layout';
66
import { sanitizeFont, sanitizeHexColor, sanitizeRadius, sanitizeGoogleFontUrl } from './sanitizer';
@@ -237,8 +237,8 @@ function generateAutoThemeSVG(
237237
params: BadgeParams,
238238
calendar: ContributionCalendar
239239
): string {
240-
const light = AUTO_LIGHT_THEME;
241-
const dark = AUTO_DARK_THEME;
240+
const light = AUTO_THEME_LIGHT;
241+
const dark = AUTO_THEME_DARK;
242242
const safeUser = escapeXML(params.user || 'GitHub User');
243243
const sanitizedFont = sanitizeFont(params.font);
244244
const selectedFont = sanitizedFont
@@ -426,8 +426,8 @@ export function generateMonthlySVG(stats: MonthlyStats, params: BadgeParams): st
426426
}
427427

428428
function generateAutoThemeMonthlySVG(stats: MonthlyStats, params: BadgeParams): string {
429-
const light = AUTO_LIGHT_THEME;
430-
const dark = AUTO_DARK_THEME;
429+
const light = AUTO_THEME_LIGHT;
430+
const dark = AUTO_THEME_DARK;
431431
const safeUser = escapeXML(params.user || 'GitHub User');
432432
const sanitizeFont = (name: string) => name.replace(/[^a-zA-Z0-9\s-]/g, '').trim();
433433
const sanitizedFont = params.font ? sanitizeFont(params.font) : null;

β€Žlib/svg/themes.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export const themes: Record<string, BadgeTheme> = {
2929
// Auto-theme pairs: the SVG switches between these two palettes
3030
// using @media (prefers-color-scheme) so the badge adapts to the
3131
// viewer's OS-level light/dark setting without any JavaScript.
32-
export const AUTO_LIGHT_THEME: BadgeTheme = themes.light;
33-
export const AUTO_DARK_THEME: BadgeTheme = themes.dark;
32+
export const AUTO_THEME_LIGHT: BadgeTheme = themes.light;
33+
export const AUTO_THEME_DARK: BadgeTheme = themes.dark;

0 commit comments

Comments
Β (0)