-
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
2bc921c
commit 8350b63
Showing
5 changed files
with
7 additions
and
41 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
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,18 +0,0 @@ | ||
function updateThemeColor() { | ||
const metaThemeColor = document.getElementById('theme-color'); | ||
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; | ||
|
||
if (isDarkMode) { | ||
// Set theme color for dark mode | ||
metaThemeColor.setAttribute('content', '#121212'); // Dark mode theme color (black) | ||
} else { | ||
// Set theme color for light mode | ||
metaThemeColor.setAttribute('content', '#eeeeee'); // Light mode theme color (white) | ||
} | ||
} | ||
|
||
// Call the function to set theme color on page load | ||
updateThemeColor(); | ||
|
||
// Listen for changes in the system's color scheme (e.g., if the user switches themes) | ||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateThemeColor); | ||
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