Skip to content

Commit 6281254

Browse files
committed
Added light mode
1 parent f37f0ae commit 6281254

25 files changed

+316
-321
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "koshelf"
3-
version = "1.0.9"
3+
version = "1.0.10"
44
description = "Transform your KOReader library into a beautiful reading dashboard with statistics."
55
repository = "https://github.com/paviro/KOShelf"
66
license = "EUPL-1.2 license"

assets/calendar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ function showEventModal(_title, event) {
223223
// Animate open
224224
modal.classList.remove('hidden');
225225
modal.classList.add('opacity-0');
226+
modalCard.classList.add('scale-95', 'opacity-0');
226227
modal.offsetHeight; // Force reflow
227228
requestAnimationFrame(() => {
228229
modal.classList.replace('opacity-0', 'opacity-100');
@@ -242,8 +243,6 @@ function hideModal() {
242243

243244
setTimeout(() => {
244245
modal.classList.add('hidden');
245-
modal.classList.remove('opacity-0');
246-
modalCard.classList.remove('scale-95', 'opacity-0');
247246
}, 300);
248247
}
249248

assets/heatmap.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ class ActivityHeatmap {
140140
updateActiveYearOption(selectedOption) {
141141
const allOptions = document.querySelectorAll('.year-option');
142142
allOptions.forEach(opt => {
143-
opt.classList.remove('bg-dark-750', 'text-white');
143+
opt.classList.remove('bg-dark-700', 'text-white');
144144
opt.classList.add('text-dark-200');
145145
});
146146

147-
selectedOption.classList.add('bg-dark-750', 'text-white');
147+
selectedOption.classList.add('bg-dark-700', 'text-white');
148148
selectedOption.classList.remove('text-dark-200');
149149
}
150150

@@ -282,16 +282,18 @@ class ActivityHeatmap {
282282
// Apply styling and interactions to a heatmap cell
283283
applyCellStyling(cell, activityLevel, dateStr, activityObj) {
284284
const colorClasses = [
285-
'bg-dark-700', // 0 (no activity)
286-
'bg-green-900', // 1 (low)
287-
'bg-green-700', // 2 (medium)
288-
'bg-green-500', // 3 (high)
289-
'bg-green-300' // 4 (very high)
285+
['bg-gray-200', 'dark:bg-dark-700'], // 0 (no activity)
286+
['bg-green-100', 'dark:bg-green-900'], // 1 (low)
287+
['bg-green-300', 'dark:bg-green-700'], // 2 (medium)
288+
['bg-green-500', 'dark:bg-green-500'], // 3 (high)
289+
['bg-green-600', 'dark:bg-green-300'] // 4 (very high)
290290
];
291291

292-
// Remove all color classes and add the appropriate one
293-
colorClasses.forEach(cls => cell.classList.remove(cls));
294-
cell.classList.add(colorClasses[activityLevel]);
292+
// Remove all possible color classes
293+
colorClasses.flat().forEach(cls => cell.classList.remove(cls));
294+
295+
// Add both light and dark mode classes for the current activity level
296+
colorClasses[activityLevel].forEach(cls => cell.classList.add(cls));
295297

296298
// Set tooltip
297299
const readLabel = DateUtils.formatDuration(activityObj.read);

assets/input.css

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@
1010

1111
@layer components {
1212
.sidebar-item {
13-
@apply flex items-center px-4 py-3 text-dark-300 hover:text-white hover:bg-dark-700 rounded-lg mx-2 transition-all duration-200;
13+
@apply flex items-center px-4 py-3 text-gray-700 dark:text-dark-200 hover:text-primary-600 dark:hover:text-primary-300 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-lg mx-2 transition-all duration-200;
1414
}
1515

1616
.sidebar-item-active {
1717
@apply bg-primary-600 text-white shadow-lg;
1818
}
1919

2020
.sidebar-item-modern {
21-
@apply flex items-center space-x-3 px-4 py-3 rounded-lg mx-2 transition-all duration-200 hover:bg-dark-800/50;
21+
@apply flex items-center space-x-3 px-4 py-3 rounded-lg mx-2 transition-all duration-200 hover:bg-primary-50 dark:hover:bg-primary-900/20;
2222
}
2323

2424
.sidebar-item-modern-active {
25-
@apply bg-dark-800/70 border border-dark-700/50 shadow-sm;
25+
@apply bg-primary-50 dark:bg-primary-900/30 border border-primary-200 dark:border-primary-700/50 shadow-sm;
2626
}
2727

2828
.nav-item {
29-
@apply text-dark-300 hover:text-white transition-all duration-200;
29+
@apply text-gray-600 dark:text-dark-300 hover:text-gray-900 dark:hover:text-white transition-all duration-200;
3030
}
3131

3232
.nav-item-active {
33-
@apply text-primary-400 bg-dark-700/60;
33+
@apply text-primary-400 bg-gray-100/60 dark:bg-dark-700/60;
3434
}
3535

3636
.book-card {
37-
@apply relative bg-dark-800 rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 hover:shadow-2xl;
37+
@apply relative bg-white dark:bg-dark-800 rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 hover:shadow-2xl;
3838
}
3939

4040
.book-progress-bar {
@@ -50,11 +50,11 @@
5050
}
5151

5252
.search-input {
53-
@apply w-full bg-dark-700 border border-dark-600 rounded-lg px-4 py-2 text-white placeholder-dark-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent;
53+
@apply w-full bg-gray-100 dark:bg-dark-700 border border-gray-300 dark:border-dark-600 rounded-lg px-4 py-2 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-dark-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent;
5454
}
5555

5656
.filter-button {
57-
@apply px-4 py-2 bg-dark-700 hover:bg-dark-600 text-dark-300 hover:text-white rounded-lg transition-all duration-200 shadow;
57+
@apply px-4 py-2 bg-gray-100 dark:bg-dark-700 hover:bg-gray-200 dark:hover:bg-dark-600 text-gray-600 dark:text-dark-300 hover:text-gray-900 dark:hover:text-white rounded-lg transition-all duration-200 shadow;
5858
}
5959

6060
.filter-button-active {
@@ -134,7 +134,7 @@
134134
.ec-dark .ec-day-head,
135135
.ec-dark .ec-sidebar,
136136
.ec-dark .ec-popup {
137-
@apply border-dark-700;
137+
@apply border-gray-200 dark:border-dark-700;
138138
}
139139

140140
/* Calendar container specific styles */
@@ -167,12 +167,12 @@
167167

168168
.calendar-container .ec .ec-header .ec-days {
169169
margin: 0;
170-
@apply bg-dark-800 shadow border-b border-dark-700 rounded-t-lg;
171-
@apply text-sm md:text-base lg:text-lg xl:text-xl py-2;
170+
@apply bg-gray-200 dark:bg-dark-800 shadow-sm border-b border-gray-200 dark:border-dark-700 rounded-t-lg;
171+
@apply text-gray-800 dark:text-primary-300 text-sm md:text-base lg:text-lg xl:text-xl py-2 font-medium;
172172
}
173173

174174
.calendar-container .ec .ec-header .ec-day {
175-
@apply border-dark-700/50 py-3 font-medium text-primary-300;
175+
@apply border-gray-300 dark:border-dark-700/50 py-3 font-medium text-primary-800 dark:text-primary-300;
176176
border-right-width: 1px;
177177
border-right-style: solid;
178178
}
@@ -192,37 +192,23 @@
192192

193193
/* Style the calendar body */
194194
.calendar-container .ec .ec-body {
195-
@apply bg-dark-850/50 rounded-lg mt-1 border border-dark-700;
195+
@apply bg-gray-50 dark:bg-dark-850/50 rounded-lg mt-1 border border-gray-200 dark:border-dark-700 shadow-sm;
196196
border-top: none;
197197
}
198198

199-
/* Only show inner borders */
199+
/* Day cell borders and hover */
200200
.calendar-container .ec .ec-day {
201-
border-color: rgba(51, 65, 85, 0.5); /* dark-700 with opacity */
202-
}
203-
204-
/* Day cell styling */
205-
.day-cell {
206-
@apply transition-colors duration-200;
207-
}
208-
209-
.day-cell:hover {
210-
@apply bg-dark-800/80;
201+
@apply border-gray-300 dark:border-dark-700/50 transition-colors duration-200;
211202
}
212203

213204
/* Today highlighting */
214205
.calendar-container .ec .ec-today {
215-
@apply bg-primary-900/10 font-medium;
206+
@apply bg-primary-200/60 dark:bg-primary-900/30 font-medium border border-primary-400;
216207
}
217208

218209
/* Event styling */
219-
.ec-dark .ec-event {
220-
@apply shadow-lg rounded-lg px-1 md:py-1 md:px-2;
221-
@apply text-2xs md:text-xs lg:text-sm;
222-
}
223-
224-
/* Add some spacing between events */
225-
.ec-dark .ec-event:not(:last-child) {
210+
.calendar-container .ec-event {
211+
@apply shadow-lg rounded-lg px-1 md:py-1 md:px-2 text-2xs md:text-xs lg:text-sm;
226212
@apply mb-1;
227213
}
228214

assets/statistics.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,28 @@ class StatisticsManager {
109109
});
110110

111111
// Mark first option as active if none is selected
112-
if (weekOptionElements.length > 0 && !weekOptionElements[0].classList.contains('bg-dark-750')) {
113-
weekOptionElements[0].classList.add('bg-dark-750', 'text-white');
114-
weekOptionElements[0].classList.remove('text-dark-200');
112+
if (weekOptionElements.length > 0 && !weekOptionElements[0].classList.contains('bg-primary-50')) {
113+
weekOptionElements[0].classList.add('bg-primary-50', 'dark:bg-dark-700', 'text-primary-900', 'dark:text-white');
114+
weekOptionElements[0].classList.remove('text-gray-600', 'dark:text-dark-200');
115115
}
116116
}
117117

118118
// Update active state for dropdown options
119119
updateActiveOption(allOptions, selectedOption) {
120120
allOptions.forEach(el => {
121-
el.classList.remove('bg-dark-750', 'text-white');
122-
el.classList.add('text-dark-200');
121+
// Remove both light and dark mode active classes
122+
el.classList.remove('bg-primary-50', 'dark:bg-dark-700', 'text-primary-900', 'dark:text-white', 'bg-green-50', 'text-green-900');
123+
// Reset to default text color
124+
el.classList.add('text-gray-600', 'dark:text-dark-200');
123125
});
124-
selectedOption.classList.add('bg-dark-750', 'text-white');
125-
selectedOption.classList.remove('text-dark-200');
126+
127+
// Add appropriate active classes based on the context (week or year selector)
128+
if (selectedOption.closest('#weekOptions')) {
129+
selectedOption.classList.add('bg-primary-50', 'dark:bg-dark-700', 'text-primary-900', 'dark:text-white');
130+
} else {
131+
selectedOption.classList.add('bg-green-50', 'dark:bg-dark-700', 'text-green-900', 'dark:text-white');
132+
}
133+
selectedOption.classList.remove('text-gray-600', 'dark:text-dark-200');
126134
}
127135

128136
// Show loading indicator

templates/book_details/book_details.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<title>{{ book.epub_info.title }} - {{ site_title }}</title>
77
<link rel="stylesheet" href="/assets/css/style.css">
88
</head>
9-
<body class="min-h-full bg-dark-900 text-white font-sans">
9+
<body class="min-h-full bg-gray-100 dark:bg-dark-900 text-gray-900 dark:text-white font-sans">
1010
<!-- Sidebar - Hidden on mobile, visible on md+ screens -->
1111
{% include "sidebar.html" %}
1212

1313
<!-- Header - Fixed at top -->
14-
<header class="fixed top-0 left-0 right-0 md:left-64 bg-dark-850/75 backdrop-blur-sm border-b border-dark-700/50 px-4 md:px-6 h-[70px] md:h-[80px] z-40">
14+
<header class="fixed top-0 left-0 right-0 md:left-64 bg-white/90 dark:bg-dark-850/75 backdrop-blur-sm border-b border-gray-200/50 dark:border-dark-700/50 px-4 md:px-6 h-[70px] md:h-[80px] z-40">
1515
<div class="flex items-center h-full min-w-0 flex-1">
1616
<!-- Mobile Title & Back Button -->
1717
<div class="md:hidden flex items-center space-x-3 min-w-0 flex-1">
@@ -20,20 +20,20 @@
2020
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
2121
</svg>
2222
</button>
23-
<div class="h-8 w-px bg-dark-700 mx-3 md:mx-6"></div>
23+
<div class="h-8 w-px bg-gray-200 dark:bg-dark-700 mx-3 md:mx-6"></div>
2424
<div class="min-w-0 flex-1">
25-
<h1 class="text-lg font-bold text-white truncate">{{ book.epub_info.title }}</h1>
25+
<h1 class="text-lg font-bold text-gray-900 dark:text-white truncate">{{ book.epub_info.title }}</h1>
2626
{% if !book.epub_info.authors.is_empty() %}
27-
<p class="text-xs text-dark-300 truncate">by {{ book.epub_info.authors[0] }}</p>
27+
<p class="text-xs text-gray-500 dark:text-dark-300 truncate">by {{ book.epub_info.authors[0] }}</p>
2828
{% endif %}
2929
</div>
3030
</div>
3131

3232
<!-- Desktop Title -->
3333
<div class="hidden md:block min-w-0 flex-1">
34-
<h1 class="text-2xl font-bold text-white truncate">{{ book.epub_info.title }}</h1>
34+
<h1 class="text-2xl font-bold text-gray-900 dark:text-white truncate">{{ book.epub_info.title }}</h1>
3535
{% if !book.epub_info.authors.is_empty() %}
36-
<p class="text-sm text-dark-300 truncate">by {{ book.epub_info.authors[0] }}</p>
36+
<p class="text-sm text-gray-500 dark:text-dark-300 truncate">by {{ book.epub_info.authors[0] }}</p>
3737
{% endif %}
3838
</div>
3939
</div>

templates/book_details/components/additional_info.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<!-- Additional Information -->
22
<section data-name="additional-info" data-default-visible="false">
3-
<div class="flex items-center justify-between mb-4 md:mb-6 pb-4 border-b border-dark-700/50">
3+
<div class="flex items-center justify-between mb-4 md:mb-6 pb-4 border-b border-gray-200/50 dark:border-dark-700/50">
44
<div class="flex items-center space-x-3">
55
<div class="w-2 h-6 md:h-8 bg-gradient-to-b from-cyan-400 to-cyan-600 rounded-full"></div>
6-
<h2 class="text-xl md:text-2xl font-bold text-white">Additional Information</h2>
6+
<h2 class="text-xl md:text-2xl font-bold text-gray-900 dark:text-white">Additional Information</h2>
77
</div>
88

99
<!-- Hide/Show Button -->
10-
<button class="flex items-center space-x-2 px-3 py-2 bg-dark-800/50 border border-dark-700/70 rounded-lg hover:bg-dark-700/50 transition-colors">
11-
<span class="text-sm text-dark-300">Loading...</span>
12-
<svg class="w-4 h-4 text-dark-300 transform transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24">
10+
<button class="flex items-center space-x-2 px-3 py-2 bg-gray-100/50 dark:bg-dark-800/50 border border-gray-300/70 dark:border-dark-700/70 rounded-lg hover:bg-gray-200/50 dark:hover:bg-dark-700/50 transition-colors">
11+
<span class="text-sm text-gray-600 dark:text-dark-300">Loading...</span>
12+
<svg class="w-4 h-4 text-gray-600 dark:text-dark-300 transform transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1313
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
1414
</svg>
1515
</button>
@@ -20,25 +20,25 @@ <h2 class="text-xl md:text-2xl font-bold text-white">Additional Information</h2>
2020
<div class="space-y-6">
2121
{% match book.publisher() %}
2222
{% when Some with (publisher) %}
23-
<div class="bg-dark-800/50 border border-dark-700/70 rounded-lg p-4">
23+
<div class="bg-white dark:bg-dark-800 border border-gray-200/70 dark:border-dark-700/70 rounded-lg p-4">
2424
<div class="flex items-center space-x-3">
2525
<div class="w-10 h-10 bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-lg flex items-center justify-center">
2626
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2727
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
2828
</svg>
2929
</div>
3030
<div>
31-
<div class="text-lg font-bold text-white">{{ publisher }}</div>
32-
<div class="text-sm text-dark-400">Publisher</div>
31+
<div class="text-lg font-bold text-gray-900 dark:text-white">{{ publisher }}</div>
32+
<div class="text-sm text-gray-500 dark:text-dark-400">Publisher</div>
3333
</div>
3434
</div>
3535
</div>
3636
{% when None %}
3737
{% endmatch %}
3838

3939
{% if !book.identifiers().is_empty() %}
40-
<div class="bg-dark-800/50 border border-dark-700/70 rounded-lg p-6">
41-
<h4 class="text-lg font-semibold text-white mb-4 flex items-center">
40+
<div class="bg-white dark:bg-dark-800 border border-gray-200/70 dark:border-dark-700/70 rounded-lg p-6">
41+
<h4 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center">
4242
<div class="w-8 h-8 bg-gradient-to-br from-purple-500 to-purple-600 rounded-lg flex items-center justify-center mr-3">
4343
<svg class="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
4444
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"></path>
@@ -50,27 +50,27 @@ <h4 class="text-lg font-semibold text-white mb-4 flex items-center">
5050
{% for identifier in book.identifiers() %}
5151
{% if identifier.is_linkable() %}
5252
<a href="{{ identifier.url().unwrap() }}" target="_blank" rel="noopener noreferrer"
53-
class="group relative bg-dark-700/50 border border-dark-600/70 rounded-lg p-4 hover:border-primary-500 hover:bg-dark-650/50 transition-all duration-200 shadow-sm hover:shadow-md">
53+
class="group relative bg-gray-100 dark:bg-dark-700 border border-gray-300 dark:border-dark-600 rounded-lg p-4 hover:border-primary-500 hover:bg-primary-50 dark:hover:bg-dark-650 transition-all duration-200 shadow-sm hover:shadow-md">
5454
<div class="flex items-center justify-between mb-2">
55-
<div class="text-sm font-medium text-primary-300 uppercase tracking-wide group-hover:text-primary-200">
55+
<div class="text-sm font-medium text-primary-600 dark:text-primary-300 uppercase tracking-wide group-hover:text-primary-700 dark:group-hover:text-primary-200">
5656
{{ identifier.display_scheme() }}
5757
</div>
58-
<div class="text-dark-400 transform translate-x-1 group-hover:translate-x-0 transition-all duration-200">
58+
<div class="text-gray-400 dark:text-dark-400 transform translate-x-1 group-hover:translate-x-0 transition-all duration-200">
5959
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
6060
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
6161
</svg>
6262
</div>
6363
</div>
64-
<div class="text-sm text-dark-300 font-mono break-all group-hover:text-white transition-colors duration-200">
64+
<div class="text-sm text-gray-700 dark:text-dark-300 font-mono break-all group-hover:text-gray-900 dark:group-hover:text-white transition-colors duration-200">
6565
{{ identifier.value }}
6666
</div>
6767
</a>
6868
{% else %}
69-
<div class="bg-dark-700/50 border border-dark-600/70 rounded-lg p-4 shadow-sm">
70-
<div class="text-sm font-medium text-primary-300 uppercase tracking-wide mb-2">
69+
<div class="bg-gray-100 dark:bg-dark-700 border border-gray-300 dark:border-dark-600 rounded-lg p-4 shadow-sm">
70+
<div class="text-sm font-medium text-primary-600 dark:text-primary-300 uppercase tracking-wide mb-2">
7171
{{ identifier.display_scheme() }}
7272
</div>
73-
<div class="text-sm text-dark-300 font-mono break-all">
73+
<div class="text-sm text-gray-700 dark:text-dark-300 font-mono break-all">
7474
{{ identifier.value }}
7575
</div>
7676
</div>

0 commit comments

Comments
 (0)