diff --git a/src/css/main.css b/src/css/main.css index 1628381..4206706 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -2,9 +2,6 @@ * Version: 1.0.0 */ -/* :root { */ -/* color-scheme: only light; */ -/* } */ html, body { margin: 0px; @@ -57,7 +54,6 @@ ul.dashed { html.theme-dark { color-scheme: dark; - background-image: none; background-image: linear-gradient(-10deg, #1010206F 60%, #5050506F); color: white; } diff --git a/src/index.html b/src/index.html index ed10671..7a3d46e 100644 --- a/src/index.html +++ b/src/index.html @@ -7,7 +7,9 @@ -
+
+ +

Ward Truyen home

diff --git a/src/js/theme.js b/src/js/theme.js index c1c7ee8..a93ed70 100644 --- a/src/js/theme.js +++ b/src/js/theme.js @@ -2,6 +2,11 @@ function toggleTheme() { const theme = "theme-dark";//localStorage.getItem('theme'); const root = document.querySelector(":root"); root.classList.toggle(theme); + if (root.classList.contains(theme)) { + localStorage.setItem('theme', theme); + } else { + localStorage.setItem('theme', "theme-light"); + } } function setTheme(themeName) { @@ -23,12 +28,11 @@ function detectTheme() { return; } - // if (window.matchMedia('(prefers-color-scheme: light)').matches) { - // setTheme('theme-light'); - // return; - // } + if (window.matchMedia('(prefers-color-scheme: light)').matches) { + setTheme('theme-light'); + return; + } - // setTheme('theme-light'); + setTheme('theme-light'); } detectTheme(); -