diff options
author | TinWoodman92 <chrhodgden@gmail.com> | 2023-12-23 11:31:11 -0600 |
---|---|---|
committer | TinWoodman92 <chrhodgden@gmail.com> | 2023-12-23 11:31:11 -0600 |
commit | 069a545a706622e073f5aa7e46557b1e560a64fc (patch) | |
tree | 4c574b9a4d2b09f1bc8af0b0cda5e3a510a133b5 | |
parent | c07fa79f178e27ef16aeda15634555c60b6b695e (diff) |
added dark mode media query
-rw-r--r-- | app.js | 1 | ||||
-rw-r--r-- | style.css | 12 |
2 files changed, 13 insertions, 0 deletions
@@ -16,6 +16,7 @@ const initInput = function(styleVariable=null) { document.documentElement.style.setProperty(styleVariable, initValue); } else { initValue = getComputedStyle(document.body).getPropertyValue(styleVariable); + initValue = Number(initValue); }; const inputObject = document.getElementById(styleVariable); @@ -42,6 +42,18 @@ --contrast-color: hsl(var(--contrast-hue), 100%, var(--contrast-lightness)); } +@media (prefers-color-scheme: dark) { + :root { + --dark-theme-check: 1; + } +} + +@media (prefers-color-scheme: light) { + :root { + --dark-theme-check: 0; + } +} + ::selection { background-color: var(--contrast-color); color: hsl(0, 0%, var(--background-lightness)); |