Skip to content

Commit

Permalink
dark/light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TrianguloY committed Dec 3, 2023
1 parent bc7fdad commit f17d8b1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions derpiViewer/derpiViewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta id="color-scheme" name="color-scheme" content="dark light" />
<title>DerpiViewer</title>
</head>

<style>
/* dark centered background */
body {
background-color: #333333;
margin: 0 auto;
}

Expand Down Expand Up @@ -48,7 +48,6 @@
/* white readable keeping-spaces text */
span,code {
font-size: 20px;
color: #ffffff;
white-space: pre-line;
word-break: break-word;
}
Expand All @@ -70,14 +69,6 @@
left: 50%;
transform: translate(-50%, -50%);
}

/* links */
a:link {
color: #00bbff;
}
a:visited {
color: #ffbbff;;
}

</style>

Expand Down Expand Up @@ -165,6 +156,7 @@
img_loading: ["Image loading method: if lazy, images will load when you scroll near them. On eager they will load inmediately", [2, 'eager', 'lazy']],
fix_scroll: ["Enable this if the page jumps when loading images", [2, 'yes', 'no']],
max_width: ["Maximum width of the page (px)", 1000],
color_scheme: ["Color scheme", [1, 'dark', 'light']],
}

function initSettings() {
Expand Down Expand Up @@ -238,6 +230,10 @@
// the max_width needs to sync instantaneously with the css property
document.body.style.maxWidth = settings[s] + 'px'
}
if(s=='color_scheme'){
// the color scheme must update
document.getElementById("color-scheme").content = settings[s];
}
}

////////// image loading //////////
Expand Down

0 comments on commit f17d8b1

Please sign in to comment.