feat(themes): v2.1.0 - themes personnalisés avec presets light/dark/high-contrast/sepia

- 4 modes: dark, light, high-contrast, sepia (40+ CSS vars chacun)
- Import/export thèmes personnalisés en JSON
- Grid swatches dans les paramètres avec preview
- toggleThemeMode() cycle through all 4 modes
- CustomEvent 'themechange' dispatché
- 18 tests unitaires (structure, generators, colors, i18n keys)
- 439 tests passent au total
This commit is contained in:
2026-09-06 18:42:20 -04:00
parent 09912509cb
commit c8b861f0b6
3 changed files with 392 additions and 6 deletions
+4 -2
View File
@@ -177,14 +177,16 @@ export function toggleTheme() {
// Update the theme toggle label
const themeLabel = document.getElementById("theme-label");
if (themeLabel) {
themeLabel.textContent = newMode === "dark" ? t('theme.dark') : t('theme.light');
const modeLabelMap = { dark: 'theme.dark', light: 'theme.light', 'high-contrast': 'theme.high_contrast', sepia: 'theme.sepia' };
themeLabel.textContent = t(modeLabelMap[newMode] || 'theme.dark');
}
// Update the theme toggle icon
const themeBtn = document.getElementById("theme-toggle");
if (themeBtn) {
const icon = themeBtn.querySelector("i");
if (icon) {
icon.setAttribute("data-lucide", newMode === "dark" ? "moon" : "sun");
const isLight = newMode === "light" || newMode === "sepia";
icon.setAttribute("data-lucide", isLight ? "sun" : "moon");
}
}
safeCreateIcons();