From 13f301ce3a8980c1ccc82881e1a6606be96f98fb Mon Sep 17 00:00:00 2001 From: britz Date: Sat, 18 Apr 2026 16:41:02 +0530 Subject: [PATCH] feat: add midnight theme for SVG cards - New MIDNIGHT theme with cleaner dark colors (#09090b #18181b) - Add --midnight flag to flex card command - Theme precedence: midnight > light > dark --- src/index.js | 7 ++++--- src/svg.js | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 94a297e..6fb6135 100755 --- a/src/index.js +++ b/src/index.js @@ -63,19 +63,20 @@ program .command('card') .description('Generate a shareable SVG card') .option('--dark', 'Dark theme (default)') + .option('--midnight', 'Midnight theme') .option('--light', 'Light theme') .option('-p, --period ', 'today, week, month, all', 'all') .option('-o, --output ', 'Output file', 'flex-card.svg') .action((opts) => { ensureRepo(); - const theme = opts.light ? 'light' : 'dark'; + const theme = opts.midnight ? 'midnight' : opts.light ? 'light' : 'dark'; const { since, label } = getTimeRange(opts.period); const repoName = getRepoName(); const stats = computeStats({ since }); const streakData = getStreakData(getCurrentUser()); const svg = generateSVG(stats, streakData, repoName, label, theme); writeFileSync(opts.output, svg); - console.log(`\u2728 Card saved to ${opts.output} (${theme} theme)`); + console.log(`✨ Card saved to ${opts.output} (${theme} theme)`); }); program @@ -102,4 +103,4 @@ program console.log(renderLangs(stats, repoName, label)); }); -program.parse(); +program.parse(); \ No newline at end of file diff --git a/src/svg.js b/src/svg.js index 498ea1e..55b4f88 100644 --- a/src/svg.js +++ b/src/svg.js @@ -9,6 +9,13 @@ const DARK = { purple: '#bc8cff', grad1: '#0d1117', grad2: '#161b22', }; +const MIDNIGHT = { + bg1: '#09090b', bg2: '#18181b', border: '#27272a', + text: '#f4f4f5', textDim: '#71717a', accent: '#10b981', + green: '#22c55e', red: '#ef4444', yellow: '#eab308', + purple: '#a855f7', grad1: '#09090b', grad2: '#18181b', +}; + const LIGHT = { bg1: '#ffffff', bg2: '#f6f8fa', border: '#d0d7de', text: '#1f2328', textDim: '#656d76', accent: '#0969da', @@ -17,7 +24,7 @@ const LIGHT = { }; export function generateSVG(stats, streakData, repoName, periodLabel, theme = 'dark') { - const c = theme === 'light' ? LIGHT : DARK; + const c = theme === 'light' ? LIGHT : theme === 'midnight' ? MIDNIGHT : DARK; const rank = getRank(stats, streakData); const level = getLevel(stats.commits); const highlights = getHighlights(stats, streakData);