Skip to content

Commit 624fe30

Browse files
committed
🌙 Release v2.6.0: Complete Dark Mode System - Smart theme toggle with OS detection, real-time switching, comprehensive component integration, CSS variables architecture, and theme-aware Chart.js/FullCalendar/Vector Maps
1 parent beb96bc commit 624fe30

38 files changed

+1840
-178
lines changed

CHANGELOG.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,119 @@
11
# Changelog
22

3+
## [2.6.0] - 2025-01-21
4+
5+
### 🌙 Dark Mode Release
6+
7+
This release introduces a comprehensive dark mode system with seamless theme switching and component integration.
8+
9+
### ✨ New Features
10+
11+
**🎨 Complete Dark Mode System:**
12+
- **Smart Theme Toggle**: Bootstrap-based switch with sun/moon icons and "Light/Dark" labels
13+
- **OS Preference Detection**: Automatically detects and applies user's preferred color scheme
14+
- **Persistent Theme Storage**: Remembers user's theme choice across sessions
15+
- **Instant Theme Switching**: Real-time theme updates without page reload
16+
17+
**🎯 Theme-Aware Components:**
18+
- **Chart.js Integration**: Dynamic color schemes for all chart types with proper contrast
19+
- **FullCalendar Support**: Dark-mode aware calendar with proper border and text colors
20+
- **Vector Maps**: Custom color palettes for both light and dark themes
21+
- **Google Maps**: Theme-specific styling for landscapes, highways, and POI markers
22+
- **Sparkline Charts**: Optimized color sets for dark mode visibility
23+
- **Skycons Weather Icons**: Adaptive colors for better dark mode contrast
24+
25+
**🎛️ CSS Architecture:**
26+
- **CSS Custom Properties**: Comprehensive variable system for consistent theming
27+
- **Semantic Color Naming**: Intuitive color variables (--c-text-base, --c-bkg-card, etc.)
28+
- **Component Isolation**: Each component respects global theme variables
29+
- **Responsive Design**: Theme switching works seamlessly across all screen sizes
30+
31+
**🖼️ Visual Enhancements:**
32+
- **Adaptive Logo**: SVG logo automatically adjusts colors based on theme
33+
- **Smart Contrast**: Proper text/background contrast ratios in both themes
34+
- **Border Consistency**: Unified border colors throughout the interface
35+
- **Loading States**: Theme-aware loaders and progress indicators
36+
37+
### 🔧 Technical Improvements
38+
39+
**🏗️ Architecture Updates:**
40+
- **Theme Utility Module**: New `src/assets/scripts/utils/theme.js` with comprehensive theme management
41+
- **CSS Variables File**: New `src/assets/styles/utils/theme.css` with light/dark color schemes
42+
- **Component Integration**: Updated all major components to support theme switching
43+
- **Event System**: Custom events for theme change notifications
44+
45+
**⚡ Performance Optimizations:**
46+
- **Efficient Switching**: Minimal DOM manipulation for theme changes
47+
- **CSS Variable Updates**: Leverages browser-native CSS custom properties
48+
- **Memory Management**: Proper cleanup of theme-related event listeners
49+
- **Build Integration**: Theme assets are properly bundled and optimized
50+
51+
### 🎮 User Experience
52+
53+
**💡 Intuitive Controls:**
54+
- **Accessible Toggle**: Proper ARIA labels and keyboard navigation support
55+
- **Visual Feedback**: Clear indication of current theme state
56+
- **Smooth Transitions**: CSS transitions for theme switching (where appropriate)
57+
- **Consistent Placement**: Theme toggle integrated into header navigation
58+
59+
**🔄 Smart Behavior:**
60+
- **First-Time Detection**: Respects OS dark mode preference on first visit
61+
- **Cross-Session Persistence**: Theme choice remembered across browser sessions
62+
- **Fallback Handling**: Graceful degradation when localStorage is unavailable
63+
- **Dynamic Updates**: All components update immediately when theme changes
64+
65+
### 🛠️ Development Experience
66+
67+
**📝 Documentation:**
68+
- **Theme API**: Comprehensive methods for theme management
69+
- **Color Guidelines**: Standardized color usage across components
70+
- **Component Examples**: Updated examples showing theme-aware components
71+
- **Migration Guide**: Instructions for theme integration in custom components
72+
73+
### 🔍 Enhanced Components
74+
75+
**📊 Charts & Data Visualization:**
76+
- Chart.js with dynamic color schemes
77+
- Sparkline charts with theme-optimized colors
78+
- Easy Pie Charts with adaptive styling
79+
- Vector maps with custom dark mode palettes
80+
81+
**🗓️ Interactive Elements:**
82+
- FullCalendar with proper dark mode borders
83+
- DataTables with theme-consistent styling
84+
- Date pickers with adaptive colors
85+
- Form elements with dark mode support
86+
87+
**🗺️ Maps & Location:**
88+
- Google Maps with custom dark mode styling
89+
- Vector maps with region-specific color schemes
90+
- Marker and overlay theme integration
91+
92+
### ⚠️ Breaking Changes
93+
94+
None. This release is fully backward compatible.
95+
96+
### 🏁 Migration Guide
97+
98+
Existing projects will automatically inherit dark mode capabilities. No code changes required.
99+
100+
**Optional Enhancements:**
101+
- Add `data-theme` attribute handling for custom components
102+
- Use CSS variables from `theme.css` for consistent coloring
103+
- Listen for `adminator:themeChanged` events for custom theme handling
104+
105+
### 📋 Files Added/Modified
106+
107+
**New Files:**
108+
- `src/assets/scripts/utils/theme.js` - Theme management utility
109+
- `src/assets/styles/utils/theme.css` - CSS variables and color schemes
110+
111+
**Enhanced Files:**
112+
- All HTML pages updated with theme-aware components
113+
- Component JavaScript files updated for theme integration
114+
- SCSS files enhanced with CSS variable usage
115+
- Logo SVG updated for theme compatibility
116+
3117
## [2.5.0] - 2025-06-16
4118

5119
### 🎉 Major Modernization Release

README.md

Lines changed: 77 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Adminator Bootstrap 5 Admin Template v2.5.0
1+
# Adminator Bootstrap 5 Admin Template v2.6.0
22

33
**Adminator** is a responsive Bootstrap 5 Admin Template built with modern development tools. It provides you with a collection of ready to use code snippets and utilities, custom pages, a collection of applications and some useful widgets.
44

5-
**Latest Update (v2.5.0)**: Completely modernized build system with latest dependencies, ESLint 9.x flat config, and enhanced development experience.
5+
**Latest Update (v2.6.0)**: Complete **Dark Mode System** with smart theme switching, OS preference detection, and seamless component integration.
6+
7+
🌙 **Dark Mode Features**: Automatic theme detection, persistent user preferences, theme-aware components (charts, calendars, maps), and a beautiful toggle switch.
68

79
Preview of this awesome admin template available here: https://colorlib.com/polygon/adminator/index.html
810

@@ -27,18 +29,31 @@ Preview of this awesome admin template available here: https://colorlib.com/poly
2729
- [Authors](#authors)
2830
- [License](#license)
2931

30-
## What's New in v2.5.0
32+
## What's New in v2.6.0
33+
34+
🌙 **Dark Mode Release** - Complete dark mode system with seamless theme switching:
3135

32-
🎉 **Major Modernization Release** - Complete overhaul of the development stack:
36+
### 🎨 Dark Mode Features
37+
- **🌗 Smart Theme Toggle**: Bootstrap-based switch with sun/moon icons and intuitive labels
38+
- **🔄 OS Preference Detection**: Automatically detects and applies your preferred color scheme
39+
- **💾 Persistent Storage**: Remembers your theme choice across browser sessions
40+
- **⚡ Instant Switching**: Real-time theme updates without page reload
41+
- **🎯 Component Integration**: All charts, calendars, maps, and UI elements are theme-aware
3342

34-
- **🚀 Latest Dependencies**: All 22+ dependencies updated to latest versions
35-
- **⚡ Modern Build Tools**: webpack 5.99.9, webpack-dev-server 5.2.2
36-
- **🔧 ESLint 9.x**: Migrated to modern flat config format
37-
- **🎨 Enhanced CSS**: Latest Sass (1.89.2), PostCSS (8.5.5), Bootstrap (5.3.6)
38-
- **📊 Updated Components**: Chart.js 4.5.0, FullCalendar 6.1.17
39-
- **🛡️ Zero Vulnerabilities**: Complete security audit with all packages secure
40-
- **🔄 Modern Tooling**: babel-loader 10.x, copy-webpack-plugin 13.x, webpack-cli 6.x
41-
- **📱 Enhanced Experience**: Better development server, faster builds, improved linting
43+
### 🛠️ Technical Implementation
44+
- **🎨 CSS Variables Architecture**: Comprehensive color system with semantic naming
45+
- **📊 Chart.js Integration**: Dynamic color schemes for all chart types
46+
- **🗓️ FullCalendar Support**: Dark-mode aware calendar with proper contrast
47+
- **🗺️ Vector Maps**: Custom color palettes for both light and dark themes
48+
- **🎪 Component Compatibility**: Theme support across all interactive elements
49+
50+
### 🚀 Previous Updates (v2.5.0)
51+
- **Latest Dependencies**: All 22+ dependencies updated to latest versions
52+
- **Modern Build Tools**: webpack 5.99.9, webpack-dev-server 5.2.2
53+
- **ESLint 9.x**: Migrated to modern flat config format
54+
- **Enhanced CSS**: Latest Sass (1.89.2), PostCSS (8.5.5), Bootstrap (5.3.6)
55+
- **Updated Components**: Chart.js 4.5.0, FullCalendar 6.1.17
56+
- **Zero Vulnerabilities**: Complete security audit with all packages secure
4257

4358
## Getting Started
4459

@@ -101,6 +116,56 @@ npm run lint:scss
101116
npm run lint
102117
```
103118

119+
## 🌙 Dark Mode Usage
120+
121+
Adminator now includes a comprehensive dark mode system that works out of the box:
122+
123+
### **Automatic Setup**
124+
- Dark mode is automatically initialized on page load
125+
- Detects your OS preference (light/dark) on first visit
126+
- Remembers your choice across browser sessions
127+
128+
### **Theme Toggle**
129+
- Look for the **Light/Dark** toggle switch in the header navigation
130+
- Click to instantly switch between light and dark themes
131+
- Visual feedback with sun ☀️ and moon 🌙 icons
132+
133+
### **For Developers**
134+
135+
**Using the Theme API:**
136+
```javascript
137+
// Get current theme
138+
const currentTheme = Theme.current(); // 'light' or 'dark'
139+
140+
// Switch themes programmatically
141+
Theme.toggle();
142+
143+
// Set specific theme
144+
Theme.apply('dark');
145+
146+
// Listen for theme changes
147+
window.addEventListener('adminator:themeChanged', (event) => {
148+
console.log('Theme changed to:', event.detail.theme);
149+
});
150+
```
151+
152+
**CSS Variables for Custom Styling:**
153+
```css
154+
.my-component {
155+
background: var(--c-bkg-card);
156+
color: var(--c-text-base);
157+
border: 1px solid var(--c-border);
158+
}
159+
```
160+
161+
**Available CSS Variables:**
162+
- `--c-bkg-body` - Main background
163+
- `--c-bkg-card` - Card backgrounds
164+
- `--c-text-base` - Primary text color
165+
- `--c-text-muted` - Secondary text color
166+
- `--c-border` - Border colors
167+
- `--c-primary` - Primary brand color
168+
104169
## Adminator for other platforms and frameworks
105170
* [Adminator right to left](https://github.com/mortezakarimi/Adminator-admin-dashboard-rtl) - Adminator modified to work with right to left languages like Persian and Arabic
106171

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adminator",
3-
"version": "2.5.0",
3+
"version": "2.6.0",
44
"private": true,
55
"description": "HTML Admin Template",
66
"scripts": {

src/assets/scripts/app.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import bootstrap from 'bootstrap';
77
import DOM from './utils/dom';
88
import DateUtils from './utils/date';
9+
import Theme from './utils/theme';
910
import Sidebar from './components/Sidebar';
1011
import ChartComponent from './components/Chart';
1112

@@ -50,6 +51,7 @@ class AdminatorApp {
5051
this.initCharts();
5152
this.initDataTables();
5253
this.initDatePickers();
54+
this.initTheme();
5355

5456
// Setup global event listeners
5557
this.setupGlobalEvents();
@@ -250,6 +252,49 @@ class AdminatorApp {
250252
});
251253
}
252254

255+
/**
256+
* Initialize theme
257+
*/
258+
initTheme() {
259+
Theme.init();
260+
261+
// inject toggle switch if missing
262+
const navRight = document.querySelector('.nav-right');
263+
if (navRight && !document.getElementById('theme-toggle')) {
264+
const li = document.createElement('li');
265+
li.className = 'theme-toggle d-flex ai-c';
266+
li.innerHTML = `
267+
<div class="form-check form-switch d-flex ai-c" style="margin: 0; padding: 0;">
268+
<label class="form-check-label me-2 text-nowrap c-grey-700" for="theme-toggle" style="font-size: 12px; margin-right: 8px;">
269+
<i class="ti-sun" style="margin-right: 4px;"></i>Light
270+
</label>
271+
<input class="form-check-input" type="checkbox" id="theme-toggle" style="margin: 0;">
272+
<label class="form-check-label ms-2 text-nowrap c-grey-700" for="theme-toggle" style="font-size: 12px; margin-left: 8px;">
273+
Dark<i class="ti-moon" style="margin-left: 4px;"></i>
274+
</label>
275+
</div>
276+
`;
277+
navRight.insertBefore(li, navRight.firstElementChild);
278+
279+
const toggleInput = li.querySelector('#theme-toggle');
280+
281+
const updateSwitch = () => {
282+
toggleInput.checked = Theme.current() === 'dark';
283+
};
284+
updateSwitch();
285+
286+
toggleInput.addEventListener('change', (e) => {
287+
Theme.apply(e.target.checked ? 'dark' : 'light');
288+
});
289+
290+
window.addEventListener('adminator:themeChanged', () => {
291+
updateSwitch();
292+
const charts = this.components.get('charts');
293+
if (charts) charts.redrawCharts();
294+
});
295+
}
296+
}
297+
253298
/**
254299
* Setup global event listeners
255300
*/

src/assets/scripts/charts/sparkline/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@ import * as $ from 'jquery';
22
import 'jquery-sparkline';
33
import { debounce } from 'lodash';
44
import { COLORS } from '../../constants/colors';
5+
import Theme from '../../utils/theme.js';
56

67
export default (function () {
78
// ------------------------------------------------------
89
// @Dashboard Sparklines
910
// ------------------------------------------------------
1011

1112
const drawSparklines = () => {
13+
const sparkColors = Theme.getSparklineColors();
14+
1215
if ($('#sparklinedash').length > 0) {
1316
$('#sparklinedash').sparkline([0, 5, 6, 10, 9, 12, 4, 9], {
1417
type: 'bar',
1518
height: '20',
1619
barWidth: '3',
1720
resize: true,
1821
barSpacing: '3',
19-
barColor: '#4caf50',
22+
barColor: sparkColors.success,
2023
});
2124
}
2225

@@ -27,7 +30,7 @@ export default (function () {
2730
barWidth: '3',
2831
resize: true,
2932
barSpacing: '3',
30-
barColor: '#9675ce',
33+
barColor: sparkColors.purple,
3134
});
3235
}
3336

@@ -38,7 +41,7 @@ export default (function () {
3841
barWidth: '3',
3942
resize: true,
4043
barSpacing: '3',
41-
barColor: '#03a9f3',
44+
barColor: sparkColors.info,
4245
});
4346
}
4447

@@ -49,7 +52,7 @@ export default (function () {
4952
barWidth: '3',
5053
resize: true,
5154
barSpacing: '3',
52-
barColor: '#f96262',
55+
barColor: sparkColors.danger,
5356
});
5457
}
5558
};
@@ -58,6 +61,9 @@ export default (function () {
5861

5962
// Redraw sparklines on resize
6063
$(window).resize(debounce(drawSparklines, 150));
64+
65+
// Listen for theme changes
66+
window.addEventListener('adminator:themeChanged', debounce(drawSparklines, 150));
6167

6268
// ------------------------------------------------------
6369
// @Other Sparklines
@@ -77,7 +83,7 @@ export default (function () {
7783
{
7884
type: 'bar',
7985
resize: true,
80-
barColor: '#aaf',
86+
barColor: Theme.getSparklineColors().light,
8187
height: '20',
8288
}
8389
);

0 commit comments

Comments
 (0)