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
11 changes: 10 additions & 1 deletion site-defaults/web/skel.htt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
<link rel="stylesheet" href="<?static:/css/dfeed.css?>">
</head>
<body class="forum <?bodyclass?>">
<script>document.body.className += ' have-javascript'</script>
<script>
(function() {
var theme = localStorage.getItem('theme') || 'light';
if (theme === 'dark') {
document.body.classList.add('dark-mode');
}
document.body.classList.add('have-javascript');
})();
</script>

<div id="top">
<div class="site-header">
Expand All @@ -23,6 +31,7 @@
</select>
<button type="submit">Search</button>
</form>
<button id="theme-toggle" title="Toggle dark/light mode">🌓</button>
</div>
</div>
</div>
Expand Down
138 changes: 135 additions & 3 deletions site-defaults/web/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ h3 { font-size: 1.25em; }
#search-box {
display: flex;
gap: 0.25em;
align-items: center;
}

#search-box input,
#search-box select,
#search-box button {
#search-box button,
#theme-toggle {
padding: 0.4em 0.6em;
border: 1px solid #ccc;
border-radius: 3px;
Expand All @@ -95,17 +97,147 @@ h3 { font-size: 1.25em; }
width: 200px;
}

#search-box button {
#search-box button,
#theme-toggle {
background: #f5f5f5;
color: #333;
cursor: pointer;
}

#search-box button:hover {
#search-box button:hover,
#theme-toggle:hover {
background: #e6e6e6;
color: #333;
}

#theme-toggle {
display: flex;
align-items: center;
justify-content: center;
padding: 0.4em;
line-height: 1;
}

/* ============== Dark Mode ============== */

body.dark-mode {
color: #ccc;
background: #1a1a1a;
}

.dark-mode a {
color: #58a6ff;
}

.dark-mode a:visited {
color: #a371f7;
}

.dark-mode #top {
background: #21262d;
border-bottom: 1px solid #30363d;
}

.dark-mode #search-box input,
.dark-mode #search-box select,
.dark-mode #search-box button,
.dark-mode #theme-toggle {
background: #0d1117;
color: #c9d1d9;
border-color: #30363d;
}

.dark-mode #search-box button:hover,
.dark-mode #theme-toggle:hover {
background: #161b22;
border-color: #8b949e;
}

.dark-mode .subnav {
background: #161b22;
border-right: 1px solid #30363d;
}

.dark-mode tr.thread-row:nth-child(even),
.dark-mode tr.thread-post-row:nth-child(even) {
background: #0d1117;
}

.dark-mode tr.thread-row:hover,
.dark-mode tr.thread-post-row:hover {
background: #161b22;
}

.dark-mode .post {
background: #0d1117;
border: 1px solid #30363d;
}

.dark-mode .post.focused {
border-color: #58a6ff;
box-shadow: 0 0 0 1px #58a6ff;
}

.dark-mode .post-header {
background: #161b22;
border-bottom: 1px solid #30363d;
}

.dark-mode .subnav > ul > li > ul {
border-left-color: #30363d;
}

.dark-mode #footernav {
border-top-color: #30363d;
color: #8b949e;
}

.dark-mode #copyright,
.dark-mode .smallprint {
color: #8b949e;
}

.dark-mode input[type="text"],
.dark-mode input[type="email"],
.dark-mode input[type="password"],
.dark-mode input[type="search"],
.dark-mode textarea,
.dark-mode select {
background: #0d1117;
color: #c9d1d9;
border-color: #30363d;
}

.dark-mode input:focus,
.dark-mode textarea:focus,
.dark-mode select:focus {
border-color: #58a6ff;
outline: none;
box-shadow: 0 0 0 1px #58a6ff;
}

.dark-mode button {
background: #21262d;
color: #c9d1d9;
border: 1px solid #30363d;
}

.dark-mode button:hover {
background: #30363d;
border-color: #8b949e;
}

.dark-mode blockquote {
border-left-color: #30363d;
color: #8b949e;
}

.dark-mode code,
.dark-mode pre {
background: #161b22;
color: #e6edf3;
}

/* ============== Main Layout ============== */

.container {
Expand Down
5 changes: 5 additions & 0 deletions site-defaults/web/static/js/dfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ $(document).ready(function() {
return false;
});

$('#theme-toggle').click(function() {
var isDark = $('body').toggleClass('dark-mode').hasClass('dark-mode');
localStorage.setItem('theme', isDark ? 'dark' : 'light');
});

syntaxHighlight($(document));
});

Expand Down