Default to theme based on user pref (#13)
* Default to theme based on user pref * Reset font-weight for tags
This commit is contained in:
@@ -98,7 +98,6 @@ html {
|
|||||||
color: white;
|
color: white;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 700;
|
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
}
|
}
|
||||||
.post-tag a {
|
.post-tag a {
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ function ready() {
|
|||||||
darkThemeCss = document.getElementById("dark-theme");
|
darkThemeCss = document.getElementById("dark-theme");
|
||||||
|
|
||||||
// TODO: Fetch programatically by user's system preference
|
// TODO: Fetch programatically by user's system preference
|
||||||
const savedTheme = localStorage.getItem(THEME_PREF_STORAGE_KEY) || 'light';
|
const savedTheme = localStorage.getItem(THEME_PREF_STORAGE_KEY) ||
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark': 'light';
|
||||||
setTheme(savedTheme);
|
setTheme(savedTheme);
|
||||||
document.getElementById('dark-theme-toggle').addEventListener('click', () => {
|
document.getElementById('dark-theme-toggle').addEventListener('click', () => {
|
||||||
if (toggleIcon.className === THEME_TO_ICON_CLASS.dark) {
|
if (toggleIcon.className === THEME_TO_ICON_CLASS.dark) {
|
||||||
|
|||||||
Reference in New Issue
Block a user