Compare commits
2 commits
10b5ce30a3
...
aa9153e50d
Author | SHA1 | Date | |
---|---|---|---|
aa9153e50d | |||
dba1380966 |
2 changed files with 18 additions and 15 deletions
|
@ -9,18 +9,18 @@ html {
|
|||
--font-family: comic-mono Consolas sans-serif;
|
||||
--syntax-tab-size: 2;
|
||||
|
||||
--background-color: var(--xkcd-very-dark-brown);
|
||||
--text-color: var(--xkcd-light-grey);
|
||||
--text-color-link: var(--xkcd-steel-blue);
|
||||
--accent-color: var(--xkcd-bronze);
|
||||
--background-color: var(--xkcd-eggshell);
|
||||
--text-color: var(--xkcd-dark-grey);
|
||||
--text-color-link: var(--xkcd-teal);
|
||||
--accent-color: var(--xkcd-red-orange);
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
@media(prefers-color-scheme: dark) {
|
||||
html {
|
||||
--background-color: var(--xkcd-eggshell);
|
||||
--text-color: var(--xkcd-dark-grey);
|
||||
--text-color-link: var(--xkcd-teal);
|
||||
--accent-color: var(--xkcd-red-orange);
|
||||
--background-color: var(--xkcd-very-dark-brown);
|
||||
--text-color: var(--xkcd-light-grey);
|
||||
--text-color-link: var(--xkcd-steel-blue);
|
||||
--accent-color: var(--xkcd-bronze);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
function themeToggle() {
|
||||
const oldValue = localStorage.getItem('theme');
|
||||
let oldValue = localStorage.getItem('theme');
|
||||
if (!oldValue) {
|
||||
oldValue = 'light';
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
oldValue = 'dark';
|
||||
}
|
||||
}
|
||||
|
||||
let newValue;
|
||||
if (oldValue == 'light') {
|
||||
newValue = 'dark';
|
||||
|
@ -15,11 +22,7 @@ function themeClear() {
|
|||
themeRefresh();
|
||||
}
|
||||
|
||||
function themeRefresh(newValue) {
|
||||
if (newValue !== undefined) {
|
||||
localStorage.setItem('theme', newValue);
|
||||
}
|
||||
|
||||
function themeRefresh() {
|
||||
const theme = localStorage.getItem('theme')
|
||||
const el = document.getElementsByTagName('html')[0];
|
||||
if (theme == 'light') {
|
||||
|
|
Loading…
Add table
Reference in a new issue