forked from sujaykundu777/devlopr-jekyll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8dfba5
commit b278bb9
Showing
7 changed files
with
45 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,12 +93,12 @@ wakatime_username: sujaykundu777 | |
mailchimp_form_url: https://sujaykundu.us10.list-manage.com/subscribe/post?u=50bab1c85eae24ecfb0f68361&id=3a2dd721d0 | ||
|
||
# contact form - (choose formspress or getform) | ||
getform_endpoint: 83b703c3-9e47-4df4-ac55-e24d7eb02abc | ||
# getform_endpoint: 83b703c3-9e47-4df4-ac55-e24d7eb02abc | ||
formspree_email: [email protected] | ||
|
||
# releases - widget can be (sidebar, modal or embed) | ||
olvy_organization: devlopr | ||
olvy_widget_type: sidebar | ||
# olvy_organization: devlopr | ||
# olvy_widget_type: sidebar | ||
|
||
# syntax highlighter | ||
markdown: kramdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,19 @@ | ||
let systemInitiatedDark = window.matchMedia("(prefers-color-scheme: dark)"); | ||
let theme = sessionStorage.getItem('theme'); | ||
|
||
function prefersColorTest(systemInitiatedDark) { | ||
if (systemInitiatedDark.matches) { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
// document.getElementById("theme-toggle").innerHTML = "Light Mode"; | ||
sessionStorage.setItem('theme', ''); | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
// document.getElementById("theme-toggle").innerHTML = "Dark Mode"; | ||
sessionStorage.setItem('theme', ''); | ||
} | ||
} | ||
systemInitiatedDark.addListener(prefersColorTest); | ||
|
||
(()=> { modeSwitcher()})(); | ||
|
||
function modeSwitcher() { | ||
let theme = sessionStorage.getItem('theme'); | ||
if (theme === "dark") { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
sessionStorage.setItem('theme', 'light'); | ||
// document.getElementById("theme-toggle").innerHTML = "Dark Mode"; | ||
} else if (theme === "light") { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
sessionStorage.setItem('theme', 'dark'); | ||
// document.getElementById("theme-toggle").innerHTML = "Light Mode"; | ||
} else if (systemInitiatedDark.matches) { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
sessionStorage.setItem('theme', 'light'); | ||
//let theme = sessionStorage.getItem('theme'); | ||
//console.log("this was triggered"); | ||
// document.getElementById("theme-toggle").innerHTML = "Dark Mode"; | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
sessionStorage.setItem('theme', 'dark'); | ||
// document.getElementById("theme-toggle").innerHTML = "Light Mode"; | ||
} | ||
} | ||
|
||
if (theme === "dark") { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
sessionStorage.setItem('theme', 'dark'); | ||
document.getElementById("theme-toggle").checked = false; | ||
// document.getElementById("theme-toggle").innerHTML = "Light Mode"; | ||
} else if (theme === "light") { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
sessionStorage.setItem('theme', 'light'); | ||
document.getElementById("theme-toggle").checked = true; | ||
// document.getElementById("theme-toggle").innerHTML = "Dark Mode"; | ||
} | ||
} | ||
|
||
// if (currentTheme === "dark") { | ||
// document.documentElement.setAttribute('data-theme', 'light'); | ||
// sessionStorage.setItem('theme', 'light'); | ||
// } else if (currentTheme === "light") { | ||
// document.documentElement.setAttribute('data-theme', 'dark'); | ||
// sessionStorage.setItem('theme', 'dark'); | ||
// }else{ | ||
// document.documentElement.setAttribute('data-theme', 'dark'); | ||
// sessionStorage.setItem('theme', 'dark'); | ||
// } | ||
// } |