diff --git a/assets/css/torchlight.css b/assets/css/torchlight.css
index 5def64b..a864f1a 100644
--- a/assets/css/torchlight.css
+++ b/assets/css/torchlight.css
@@ -126,17 +126,17 @@ opacity: 1;
Insert prompt indicators on interactive shells.
*/
.cmd::before {
- color: var(--base07);
+ color: var(--user-prompt);
content: "$ ";
}
.cmd_root::before {
- color: var(--base08);
+ color: var(--root-prompt);
content: "# ";
}
.cmd_pwsh::before {
- color: var(--base07);
+ color: var(--user-prompt);
content: "PS> ";
}
diff --git a/assets/js/set-theme.js b/assets/js/set-theme.js
new file mode 100644
index 0000000..5ee4ac4
--- /dev/null
+++ b/assets/js/set-theme.js
@@ -0,0 +1,40 @@
+const toggleButton = document.getElementById('themeToggle');
+const htmlElement = document.documentElement;
+
+function setTheme(theme) {
+ htmlElement.setAttribute('data-theme', theme);
+ localStorage.setItem('theme', theme);
+ updateToggleButton(theme);
+}
+
+function updateToggleButton(theme) {
+ toggleButton.setAttribute('aria-checked', theme === 'dark');
+}
+
+function getPreferredTheme() {
+ const storedTheme = localStorage.getItem('theme');
+ if (storedTheme) {
+ return storedTheme;
+ }
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
+}
+
+// Ensure the toggle button state is correct on load
+document.addEventListener('DOMContentLoaded', () => {
+ updateToggleButton(getPreferredTheme());
+});
+
+// Listen for toggle button clicks
+toggleButton.addEventListener('click', () => {
+ const currentTheme = htmlElement.getAttribute('data-theme') || getPreferredTheme();
+ const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
+ setTheme(newTheme);
+});
+
+// Listen for system preference changes
+window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
+ if (!localStorage.getItem('theme')) {
+ const newTheme = e.matches ? 'dark' : 'light';
+ setTheme(newTheme);
+ }
+});
\ No newline at end of file
diff --git a/config/_default/params.toml b/config/_default/params.toml
index d990007..5471e29 100644
--- a/config/_default/params.toml
+++ b/config/_default/params.toml
@@ -110,6 +110,7 @@ taglines = [
"there's no place like $HOME",
"time jumped backwards, rotating",
"tonight we test in prod",
+ "unable to decrypt error",
"unable to open display",
"undefined reference to function",
"unexpected token",
diff --git a/content/changelog.md b/content/changelog.md
index af5241a..9055be2 100644
--- a/content/changelog.md
+++ b/content/changelog.md
@@ -1,7 +1,7 @@
---
title: "/changelog"
date: "2024-05-26T21:19:08Z"
-lastmod: "2024-08-04T22:30:43Z"
+lastmod: "2024-08-15T21:21:05Z"
description: "Maybe I should keep a log of all my site-related tinkering?"
featured: false
toc: false
@@ -10,6 +10,9 @@ categories: slashes
---
*Running list of config/layout changes to the site. The full changelog is of course [on GitHub](https://github.com/jbowdre/runtimeterror/commits/main/).*
+**2024-08-15:**
+- Implemented light/dark theme toggle
+
**2024-08-04:**
- Dynamically build `robots.txt` based on [ai.robots.txt](https://github.com/ai-robots-txt/ai.robots.txt)
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 62d73c2..1c28805 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -26,7 +26,7 @@
{{- if and (gt $ageDays 365) (not .Params.timeless) -}}
-
Technology keeps moving but this post has not.
+
Technology keeps moving but this post has not.
What you're about to read hasn't been updated in more than a year. The information may be out of date. Let me know if you see anything that needs fixing.
{{- end -}}
diff --git a/layouts/partials/about.html b/layouts/partials/about.html
index f78bae7..d0e4a3e 100644
--- a/layouts/partials/about.html
+++ b/layouts/partials/about.html
@@ -1,7 +1,7 @@
{{ with .Site.Params.about }}