Skip to content

Commit

Permalink
feat(color): create condition if you have dark themes preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanGmG committed Jul 6, 2024
1 parent abd86df commit 634b648
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scripts/color-scheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ let textColor = ref("");

function initDarkMode(){

if (window.matchMedia("(prefers-color-scheme: dark)").matches){
localStorage.setItem("dark-mode", "true");
}
if (localStorage.getItem("dark-mode") === null) {
localStorage.setItem("dark-mode", "false");
}
Expand Down

0 comments on commit 634b648

Please sign in to comment.