diff --git a/static/js/faviconTheme.js b/static/js/faviconTheme.js
new file mode 100644
index 0000000..491f8e7
--- /dev/null
+++ b/static/js/faviconTheme.js
@@ -0,0 +1,28 @@
+// Get the light and dark favicon elements
+lightSchemeIcon = document.querySelector('link#light-favicon');
+darkSchemeIcon = document.querySelector('link#dark-favicon');
+
+// Set the favicon color by adding the appropriate link element
+// to the document head and removing the other
+function updateFaviconColor(dark) {
+ if (!lightSchemeIcon || !darkSchemeIcon) return;
+
+ if (dark) {
+ lightSchemeIcon.remove();
+ document.head.append(darkSchemeIcon);
+ } else {
+ document.head.append(lightSchemeIcon);
+ darkSchemeIcon.remove();
+ }
+}
+
+// Get the current theme at startup, defaulting to light
+const currentTheme = document.documentElement.getAttribute('data-theme') || 'light';
+
+// Set the favicon color on startup
+updateFaviconColor(currentTheme === 'dark');
+
+// Listen for theme changes and update the favicon color accordingly
+window.addEventListener('themeChanged', (event) => {
+ updateFaviconColor(event.detail.theme === 'dark');
+});
diff --git a/templates/partials/header.html b/templates/partials/header.html
index 049450e..0c0f6bd 100644
--- a/templates/partials/header.html
+++ b/templates/partials/header.html
@@ -14,6 +14,11 @@
{# Favicon #}
{% if config.extra.favicon %}
+ {% elif config.extra.light_favicon and config.extra.dark_favicon %}
+ {# Favicon theme switcher. If JavaScript is disabled, defaults to the light icon #}
+
+
+
{% endif %}
{% if config.extra.favicon_emoji %}