Skip to content

Commit a0152d5

Browse files
authored
v0.5.1 - Dark Classic Theme & Calendar Fixes (#74)
* Add Dark Classic theme option - Restore original Tailwind dark mode as 'Dark Classic' theme - Theme uses Tailwind's dark: utility classes instead of CSS overrides - Fix FOUC by applying dark class in theme-init.js - Users can now choose between custom Dark theme and classic Dark theme * Fix calendar event styling for dark mode - Replace invalid bg-primary classes with proper Tailwind colors - Light mode: bg-blue-100 with blue-700 text - Dark mode: bg-gray-700 with blue-300 text - Fixes white background issue on calendar events in dark themes * Make Dark Classic default and fix calendar styling for all dark themes - Set Dark Classic as default theme (restores original dark mode behavior) - Fix calendar event styling for Dark theme - Fix calendar event styling for Midnight theme - Calendar cells and event buttons now properly styled in all themes - No more white backgrounds on calendar events in dark modes
1 parent 7194d7f commit a0152d5

File tree

5 files changed

+81
-6
lines changed

5 files changed

+81
-6
lines changed

templates/calendar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ <h1 class="text-2xl font-bold text-gray-900 dark:text-white">{{.MonthName}}</h1>
295295
}
296296

297297
const cost = (event.cost || 0).toFixed(2);
298-
content += `<button
298+
content += `<button
299299
hx-get="/form/subscription/${eventId}"
300300
hx-target="#modal-content"
301301
hx-swap="innerHTML"
302302
hx-trigger="click"
303-
class="w-full text-left text-xs px-2 py-1 rounded bg-primary/20 dark:bg-primary/30 text-primary dark:text-primary-light hover:bg-primary/30 dark:hover:bg-primary/40 transition-colors cursor-pointer flex items-center justify-between"
303+
class="w-full text-left text-xs px-2 py-1 rounded bg-blue-100 dark:bg-gray-700 text-blue-700 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-gray-600 transition-colors cursor-pointer flex items-center justify-between"
304304
title="${eventName} - ${currencySymbol}${cost}"
305305
onclick="setTimeout(function() { document.getElementById('modal').classList.remove('hidden'); }, 50);">
306306
<span class="flex items-center min-w-0 flex-1">

templates/settings.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ <h3 class="text-base font-medium text-gray-900 dark:text-white mb-4">Appearance<
200200
</div>
201201
</div>
202202

203+
<div class="theme-option" data-theme="dark-classic" onclick="selectTheme('dark-classic')">
204+
<div class="theme-name">Dark Classic</div>
205+
<div class="theme-description">Original dark mode</div>
206+
<div class="theme-preview">
207+
<div class="theme-preview-color" style="background: #1f2937;"></div>
208+
<div class="theme-preview-color" style="background: #3b82f6;"></div>
209+
<div class="theme-preview-color" style="background: #10b981;"></div>
210+
</div>
211+
</div>
212+
203213
<div class="theme-option" data-theme="christmas" onclick="selectTheme('christmas')">
204214
<div class="theme-name">Christmas 🎄</div>
205215
<div class="theme-description">Festive and jolly!</div>

web/static/css/themes.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@
8383
background-color: #2a2a2a !important;
8484
}
8585

86+
/* Dark Theme - Calendar Events */
87+
[data-theme="dark"] .bg-blue-50 {
88+
background-color: #1e293b !important;
89+
}
90+
91+
[data-theme="dark"] .bg-blue-100 {
92+
background-color: #374151 !important;
93+
}
94+
95+
[data-theme="dark"] .text-blue-700 {
96+
color: #93c5fd !important;
97+
}
98+
99+
[data-theme="dark"] .hover\:bg-blue-200:hover {
100+
background-color: #4b5563 !important;
101+
}
102+
86103
/* Christmas Theme */
87104
[data-theme="christmas"] body {
88105
background: linear-gradient(135deg, #fef3f3 0%, #fef2f2 100%) !important;
@@ -166,6 +183,23 @@
166183
text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
167184
}
168185

186+
/* Midnight Theme - Calendar Events */
187+
[data-theme="midnight"] .bg-blue-50 {
188+
background-color: #1e1e2e !important;
189+
}
190+
191+
[data-theme="midnight"] .bg-blue-100 {
192+
background-color: #2a2540 !important;
193+
}
194+
195+
[data-theme="midnight"] .text-blue-700 {
196+
color: #c4b5fd !important;
197+
}
198+
199+
[data-theme="midnight"] .hover\:bg-blue-200:hover {
200+
background-color: #3a3550 !important;
201+
}
202+
169203
/* Ocean Theme */
170204
[data-theme="ocean"] body {
171205
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;

web/static/js/theme-init.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// Theme initialization - runs immediately to prevent flash
22
(function() {
3-
const theme = localStorage.getItem('subtrackr-theme') || 'default';
3+
const theme = localStorage.getItem('subtrackr-theme') || 'dark-classic';
44
document.documentElement.setAttribute('data-theme', theme);
5+
6+
// Handle Tailwind dark mode for dark-classic theme
7+
if (theme === 'dark-classic') {
8+
document.documentElement.classList.add('dark');
9+
}
510
})();

web/static/js/themes.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ const themes = {
3636
border: '#374151',
3737
}
3838
},
39+
'dark-classic': {
40+
name: 'Dark Classic',
41+
description: 'Original dark mode',
42+
useTailwindDark: true, // Special flag to use Tailwind's dark mode
43+
colors: {
44+
primary: '#3b82f6',
45+
primaryHover: '#60a5fa',
46+
secondary: '#64748b',
47+
success: '#10b981',
48+
warning: '#f59e0b',
49+
danger: '#ef4444',
50+
background: '#111827',
51+
surface: '#1f2937',
52+
surfaceHover: '#374151',
53+
text: '#f9fafb',
54+
textSecondary: '#9ca3af',
55+
border: '#374151',
56+
}
57+
},
3958
christmas: {
4059
name: 'Christmas',
4160
description: 'Festive and jolly! 🎄',
@@ -100,12 +119,19 @@ const themes = {
100119

101120
// Apply theme to document
102121
function applyTheme(themeName) {
103-
const theme = themes[themeName] || themes.default;
122+
const theme = themes[themeName] || themes['dark-classic'];
104123
const root = document.documentElement;
105124

106125
// Set theme data attribute
107126
root.setAttribute('data-theme', themeName);
108127

128+
// Handle Tailwind dark mode for dark-classic theme
129+
if (theme.useTailwindDark) {
130+
root.classList.add('dark');
131+
} else {
132+
root.classList.remove('dark');
133+
}
134+
109135
// Apply CSS variables
110136
Object.entries(theme.colors).forEach(([key, value]) => {
111137
root.style.setProperty(`--theme-${key}`, value);
@@ -153,13 +179,13 @@ function getStoredTheme() {
153179
return fetch('/api/settings/theme')
154180
.then(response => response.json())
155181
.then(data => {
156-
const theme = data.theme || 'default';
182+
const theme = data.theme || 'dark-classic';
157183
localStorage.setItem('subtrackr-theme', theme);
158184
return theme;
159185
})
160186
.catch(err => {
161187
console.error('Failed to load theme:', err);
162-
return 'default';
188+
return 'dark-classic';
163189
});
164190
}
165191

0 commit comments

Comments
 (0)