diff --git a/app/javascript/controllers/theme_controller.js b/app/javascript/controllers/theme_controller.js
index 10aa7b9a0..361ae95ed 100644
--- a/app/javascript/controllers/theme_controller.js
+++ b/app/javascript/controllers/theme_controller.js
@@ -42,8 +42,10 @@ export default class extends Controller {
// Sets or removes the data-theme attribute
setTheme(isDark) {
if (isDark) {
+ localStorage.theme = "dark";
document.documentElement.setAttribute("data-theme", "dark");
} else {
+ localStorage.theme = "light";
document.documentElement.setAttribute("data-theme", "light");
}
}
diff --git a/app/views/layouts/_dark_mode_check.html.erb b/app/views/layouts/_dark_mode_check.html.erb
new file mode 100644
index 000000000..0a0ccac2c
--- /dev/null
+++ b/app/views/layouts/_dark_mode_check.html.erb
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/app/views/layouts/shared/_head.html.erb b/app/views/layouts/shared/_head.html.erb
index 8a097475b..26fd2f29c 100644
--- a/app/views/layouts/shared/_head.html.erb
+++ b/app/views/layouts/shared/_head.html.erb
@@ -10,6 +10,7 @@
<%= combobox_style_tag %>
<%= javascript_importmap_tags %>
+ <%= render "layouts/dark_mode_check" %>
<%= turbo_refreshes_with method: :morph, scroll: :preserve %>