@@ -6,10 +6,14 @@ document.addEventListener('DOMContentLoaded', function() {
66
77 const sunSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/></svg>` ;
88 const moonSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/></svg>` ;
9+ const paletteSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13.5" cy="6.5" r=".5"/><circle cx="17.5" cy="10.5" r=".5"/><circle cx="8.5" cy="7.5" r=".5"/><circle cx="6.5" cy="12.5" r=".5"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg>` ;
910
1011 function updateThemeUI ( theme ) {
1112 if ( ! toggleBtn ) return ;
1213 if ( theme === 'dark' ) {
14+ if ( themeIconContainer ) themeIconContainer . innerHTML = paletteSVG ;
15+ if ( themeLabel ) themeLabel . textContent = 'Peras' ;
16+ } else if ( theme === 'peras' ) {
1317 if ( themeIconContainer ) themeIconContainer . innerHTML = sunSVG ;
1418 if ( themeLabel ) themeLabel . textContent = 'Light' ;
1519 } else {
@@ -21,10 +25,15 @@ document.addEventListener('DOMContentLoaded', function() {
2125 const currentTheme = document . documentElement . getAttribute ( 'data-theme' ) || 'light' ;
2226 updateThemeUI ( currentTheme ) ;
2327
28+ const themes = [ 'light' , 'dark' , 'peras' ] ;
29+
2430 if ( toggleBtn ) {
2531 toggleBtn . addEventListener ( 'click' , function ( ) {
26- const activeTheme = document . documentElement . getAttribute ( 'data-theme' ) ;
27- const newTheme = activeTheme === 'dark' ? 'light' : 'dark' ;
32+ const activeTheme = document . documentElement . getAttribute ( 'data-theme' ) || 'light' ;
33+ let currentIndex = themes . indexOf ( activeTheme ) ;
34+ if ( currentIndex === - 1 ) currentIndex = 0 ;
35+ const newTheme = themes [ ( currentIndex + 1 ) % themes . length ] ;
36+
2837 document . documentElement . setAttribute ( 'data-theme' , newTheme ) ;
2938 localStorage . setItem ( '42devops-theme' , newTheme ) ;
3039 updateThemeUI ( newTheme ) ;
0 commit comments