Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions 3ed-2018/auto-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions 3ed-2018/auto-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions 3ed-2018/dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions 3ed-2018/light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 26 additions & 1 deletion 3ed-2018/pbrstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,32 @@ p {
--legend: #000;
--footnote-btn: #6080e0;
--footnote-btn-bg: #fff;
--icon: url("/3ed-2018/light.svg");
--icon: url("/3ed-2018/auto-light.svg");
}

@media (prefers-color-scheme: dark) {
:root {
--bg: #3a3a3a;
--bg-navbar: #343434;
--bg-cse: #343434;
--bg-table: #383838;
--bg-tooltip: #444444;
--bg-navlink-active: #444;
--border-color: rgba(255, 255, 255, 0.125);
--text: #acacac;
--text-navbar: rgb(172, 172, 172, 0.75);
--landing-title: #eee;
--link: #7186ac;
--link-active: blue;
--table-outline: #dee2e6;
--text-red: #ff0000;
--text-midred: #a00000;
--fig-outline: #404040;
--legend: #acacac;
--footnote-btn: #6080e0;
--footnote-btn-bg: #3a3a3a;
--icon: url(/3ed-2018/auto-dark.svg);
}
}

body {
Expand Down
28 changes: 20 additions & 8 deletions 3ed-2018/pbrt-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,35 @@ function setPBRTDisplayModeVars(displayMode)
document.documentElement.style.setProperty('--text-red', '#ff0000');
}

function clearPBRTDisplayModeVars()
{
document.documentElement.removeAttribute("style");
}

function setPBRTDisplayMode()
{
var displayMode = localStorage.getItem("displayMode");
if(displayMode == "null") {
displayMode = 0; // no stored display mode, default to light mode
localStorage.setItem("displayMode", displayMode);
if(displayMode != null) {
setPBRTDisplayModeVars(displayMode);
}
setPBRTDisplayModeVars(displayMode);
}

function TogglePBRTDisplayMode()
{
var displayMode = localStorage.getItem("displayMode");
if(displayMode == 0) displayMode = 1;
else if(displayMode == 1) displayMode = 0;
localStorage.setItem("displayMode", displayMode); // update the stored display mode
setPBRTDisplayModeVars(displayMode);
if(displayMode == "0")
displayMode = "1";
else if(displayMode == "1")
displayMode = null;
else if(displayMode == null)
displayMode = "0";
if (displayMode != null) {
localStorage.setItem("displayMode", displayMode); // update the stored display mode
setPBRTDisplayModeVars(displayMode);
} else {
localStorage.removeItem("displayMode");
clearPBRTDisplayModeVars();
}
}

setPBRTDisplayMode();