Add dark theme
Builds / ExectOS WebSite (push) Successful in 33s

This commit is contained in:
2026-11-29 21:04:43 +01:00
parent 0680c332aa
commit 5e5d203966
3 changed files with 259 additions and 33 deletions
@@ -3,6 +3,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/images/exectos_logo.png" /> <link rel="shortcut icon" href="/images/exectos_logo.png" />
<link rel="stylesheet" type="text/css" href="/css/style.css"> <link rel="stylesheet" type="text/css" href="/css/style.css">
<script>
(function() {
var theme = "light";
try {
theme = localStorage.getItem("exectos-theme") === "dark" ? "dark" : "light";
} catch (e) {}
document.documentElement.setAttribute("data-theme", theme);
})();
</script>
<meta http-equiv="Content-type" content="application/xhtml+xml;charset=utf-8" /> <meta http-equiv="Content-type" content="application/xhtml+xml;charset=utf-8" />
<!--meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /--> <!--meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /-->
<meta name="viewport" content="width=device-width, initial-scale=0.1"> <meta name="viewport" content="width=device-width, initial-scale=0.1">
@@ -15,5 +15,33 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>
<button type="button" id="theme-toggle" class="theme-toggle" aria-label="Switch to dark theme" title="Switch to dark theme">
<svg class="theme-toggle-track-icon sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="theme-toggle-track-icon moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
<span class="theme-toggle-thumb">
<svg class="sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
</span>
</button>
</div> </div>
</div> </div>
<script>
(function() {
var root = document.documentElement;
var button = document.getElementById("theme-toggle");
function update() {
var label = root.getAttribute("data-theme") === "dark" ? "Switch to light theme" : "Switch to dark theme";
button.setAttribute("aria-label", label);
button.setAttribute("title", label);
}
button.addEventListener("click", function() {
var theme = root.getAttribute("data-theme") === "dark" ? "light" : "dark";
root.setAttribute("data-theme", theme);
try {
localStorage.setItem("exectos-theme", theme);
} catch (e) {}
update();
});
update();
})();
</script>
+221 -32
View File
@@ -38,11 +38,73 @@
:root { :root {
color-scheme : light; color-scheme : light;
/* Light theme (default) */
--bg : #FFFFFF;
--text : #333333;
--text-strong : #000000;
--muted : #999999;
--border : #DDDDDD;
--accent : #186196;
--accent-border : #186196;
--header-bg : #BEE0FF;
--header-link : #186196;
--header-hover : #000055;
--code : #186196;
--pre-bg : #3C3C3C;
--pre-border : #3D3D3D;
--pre-text : #ECECEC;
--th-bg : #BEE0FF;
--th-text : #186196;
--row-bg : #FFFFFF;
--row-alt-bg : #F2F2F2;
--row-hover-bg : #E0E0E0;
--link : #0000EE;
--link-visited : #551A8B;
--copyright : #404040;
--brand-line : linear-gradient(90deg, #7B2A9E 0%, #4A5FC0 50%, #17B6EE 100%);
--toggle-track : rgba(255, 255, 255, 0.55);
--toggle-border : rgba(24, 97, 150, 0.35);
--toggle-icon : #186196;
--toggle-glow : rgba(23, 182, 238, 0.25);
}
/* Dark theme - palette derived from the logo gradient (purple -> blue -> cyan) */
:root[data-theme="dark"] {
color-scheme : dark;
--bg : #0B1220;
--text : #D6DEE8;
--text-strong : #EEF3F8;
--muted : #8B98A9;
--border : #24324A;
--accent : #5CC8F5;
--accent-border : #17B6EE;
--header-bg : #111C2E;
--header-link : #8FD3F7;
--header-hover : #FFFFFF;
--code : #5CC8F5;
--pre-bg : #060B14;
--pre-border : #1E2A3D;
--pre-text : #E2E8F0;
--th-bg : #16243A;
--th-text : #8FD3F7;
--row-bg : #0F1828;
--row-alt-bg : #131F33;
--row-hover-bg : #1B2A44;
--link : #5CC8F5;
--link-visited : #B48AE0;
--copyright : #8B98A9;
--brand-line : linear-gradient(90deg, #7B2A9E 0%, #4A5FC0 50%, #17B6EE 100%);
--toggle-track : #0B1220;
--toggle-border : #2A3A55;
--toggle-icon : #8FD3F7;
--toggle-glow : rgba(23, 182, 238, 0.25);
} }
html { html {
color : light-dark(#333333, #FFFFFF); color : var(--text);
background-color : light-dark(#FFFFFF, #030C12); background-color : var(--bg);
margin : 0; margin : 0;
padding : 0; padding : 0;
} }
@@ -53,8 +115,16 @@ body {
padding : 0; padding : 0;
} }
a {
color : var(--link);
}
a:visited {
color : var(--link-visited);
}
code { code {
color : #186196; color : var(--code);
font-weight : bold; font-weight : bold;
} }
@@ -66,7 +136,7 @@ h1 {
} }
h2 { h2 {
border-bottom : 1px solid #DDDDDD; border-bottom : 1px solid var(--border);
font-size : 30px; font-size : 30px;
margin-left : -1em; margin-left : -1em;
margin-right : -1em; margin-right : -1em;
@@ -86,10 +156,10 @@ img {
} }
pre { pre {
background-color : #3C3C3C; background-color : var(--pre-bg);
border-color : #3D3D3D; border : 1px solid var(--pre-border);
border-radius : 4px; border-radius : 4px;
color : #ECECEC; color : var(--pre-text);
display : block; display : block;
font-size : 13px; font-size : 13px;
line-height : 1.42857143; line-height : 1.42857143;
@@ -101,7 +171,7 @@ pre {
} }
pre code { pre code {
color : #ECECEC; color : var(--pre-text);
font-weight : normal; font-weight : normal;
} }
@@ -114,7 +184,7 @@ table {
} }
td, th { td, th {
border-bottom : 1px solid #DDDDDD; border-bottom : 1px solid var(--border);
padding : 6px 15px; padding : 6px 15px;
text-align : left; text-align : left;
} }
@@ -131,22 +201,22 @@ td.nick-cell .avatar {
} }
thead th { thead th {
background-color : #BEE0FF; background-color : var(--th-bg);
border-bottom : 2px solid #186196; border-bottom : 2px solid var(--accent-border);
color : #186196; color : var(--th-text);
font-size : 1.1em; font-size : 1.1em;
} }
tbody tr { tbody tr {
background-color : #FFFFFF; background-color : var(--row-bg);
} }
tbody tr:nth-of-type(even) { tbody tr:nth-of-type(even) {
background-color : #f2f2f2; background-color : var(--row-alt-bg);
} }
tbody tr:hover { tbody tr:hover {
background-color : #e0e0e0; background-color : var(--row-hover-bg);
} }
.content { .content {
@@ -170,7 +240,7 @@ tbody tr:hover {
} }
.copyright { .copyright {
color : #404040; color : var(--copyright);
font-family : "Source Sans Pro", "Trebuchet MS", "Verdana", sans-serif; font-family : "Source Sans Pro", "Trebuchet MS", "Verdana", sans-serif;
font-size : 10px; font-size : 10px;
text-align : center; text-align : center;
@@ -178,18 +248,18 @@ tbody tr:hover {
} }
.copyright a { .copyright a {
color : #404040; color : var(--copyright);
text-decoration : none; text-decoration : none;
} }
.copyright a:hover { .copyright a:hover {
color : #404040; color : var(--copyright);
text-decoration : none; text-decoration : none;
} }
.footer { .footer {
background : light-dark(#FFFFFF, #030C12); background : var(--bg);
color : light-dark(#000000, #FFFFFF); color : var(--text-strong);
clear : both; clear : both;
font-family : sans-serif, verdana, Helvetica; font-family : sans-serif, verdana, Helvetica;
font-size : 12px; font-size : 12px;
@@ -213,19 +283,20 @@ tbody tr:hover {
} }
.header { .header {
background : light-dark(#BEE0FF, #2185D0); background : var(--header-bg);
border-bottom : 2px solid #186196; border-bottom : 2px solid var(--accent-border);
color : #186196; color : var(--header-link);
clear : both; clear : both;
font-size : 14px; font-size : 14px;
padding-left : 1em; padding-left : 1em;
position : relative;
padding-top : 1px; padding-top : 1px;
text-align : center; text-align : center;
vertical-align : middle; vertical-align : middle;
} }
.header a { .header a {
color : light-dark(#186196, #CCCCCC); color : var(--header-link);
padding-left : 5px; padding-left : 5px;
padding-right : 5px; padding-right : 5px;
padding-top : 1px; padding-top : 1px;
@@ -233,7 +304,7 @@ tbody tr:hover {
} }
.header a:hover { .header a:hover {
color : light-dark(#000055, #FFFFFF); color : var(--header-hover);
padding-left : 5px; padding-left : 5px;
padding-right : 5px; padding-right : 5px;
padding-top : 1px; padding-top : 1px;
@@ -256,12 +327,12 @@ tbody tr:hover {
} }
.news_author { .news_author {
color : #999999; color : var(--muted);
float : left; float : left;
} }
.news_date { .news_date {
color : #999999; color : var(--muted);
float : right; float : right;
} }
@@ -308,8 +379,8 @@ tbody tr:hover {
} }
.wrapper_header { .wrapper_header {
background : light-dark(#FFFFFF, #030C12); background : var(--bg);
color : light-dark(#000000, #FFFFFF); color : var(--text-strong);
height : 6em; height : 6em;
left : 0; left : 0;
position : absolute; position : absolute;
@@ -319,13 +390,131 @@ tbody tr:hover {
} }
.wrapper_footer { .wrapper_footer {
background : light-dark(#FFFFFF, #030C12); background : var(--bg);
border-top : 2px solid #186196; border-top : 2px solid var(--accent-border);
bottom : 0; bottom : 0;
color : #000000; color : var(--text-strong);
height : 1.5em; height : 1.5em;
left : 0; left : 0;
position : absolute; position : absolute;
position : fixed; position : fixed;
width : 100% width : 100%
} }
/* Brand line (logo gradient) separating header and footer from the content */
.header,
.wrapper_footer {
border-image : var(--brand-line) 1;
}
/* Theme switch (right side of the header, vertically centered) */
.theme-toggle {
background : var(--toggle-track);
border : 1px solid var(--toggle-border);
border-radius : 999px;
box-sizing : border-box;
cursor : pointer;
height : 32px;
padding : 0;
position : absolute;
right : 1.25em;
top : 50%;
transform : translateY(-50%);
transition : background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
width : 62px;
}
.theme-toggle:hover {
box-shadow : 0 0 0 3px var(--toggle-glow);
}
.theme-toggle:focus-visible {
outline : 2px solid var(--accent);
outline-offset : 3px;
}
.theme-toggle svg {
display : block;
fill : none;
stroke : currentColor;
stroke-linecap : round;
stroke-linejoin : round;
stroke-width : 2;
}
.theme-toggle-track-icon {
color : var(--toggle-icon);
height : 14px;
position : absolute;
top : 50%;
transform : translateY(-50%);
width : 14px;
}
.theme-toggle-track-icon.sun {
left : 8px;
}
.theme-toggle-track-icon.moon {
right : 8px;
}
.theme-toggle-thumb {
background : var(--brand-line);
border-radius : 50%;
box-shadow : 0 1px 4px rgba(0, 0, 0, 0.35);
color : #FFFFFF;
height : 24px;
left : 3px;
position : absolute;
top : 3px;
transition : transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
width : 24px;
}
.theme-toggle-thumb svg {
height : 14px;
left : 5px;
position : absolute;
top : 5px;
transition : opacity 0.3s, transform 0.3s;
width : 14px;
}
.theme-toggle-thumb .moon {
opacity : 0;
transform : rotate(-90deg) scale(0.5);
}
:root[data-theme="dark"] .theme-toggle-thumb {
transform : translateX(30px);
}
:root[data-theme="dark"] .theme-toggle-thumb .sun {
opacity : 0;
transform : rotate(90deg) scale(0.5);
}
:root[data-theme="dark"] .theme-toggle-thumb .moon {
opacity : 1;
transform : none;
}
/* Dark theme refinements */
:root[data-theme="dark"] .header h1 a {
color : var(--text-strong);
}
:root[data-theme="dark"] .header h1 a:hover {
color : var(--header-link);
}
:root[data-theme="dark"] .content img {
border-radius : 4px;
filter : brightness(0.92);
}
:root[data-theme="dark"] ::selection {
background : #4A5FC0;
color : #FFFFFF;
}