diff --git a/javascripts/discourse/initializers/dark-light-toggle-hamburger.js b/javascripts/discourse/initializers/dark-light-toggle-hamburger.js index d1e72cc..1e6ee6c 100644 --- a/javascripts/discourse/initializers/dark-light-toggle-hamburger.js +++ b/javascripts/discourse/initializers/dark-light-toggle-hamburger.js @@ -70,6 +70,7 @@ Have you selected two different themes for your dark/light schemes in user prefe lightTheme.media = "none"; Session.currentProp("defaultColorSchemeIsDark", true); + Session.currentProp("darkModeAvailable", true); }; let switchToLight = function () { @@ -81,6 +82,7 @@ Have you selected two different themes for your dark/light schemes in user prefe darkTheme.media = "none"; Session.currentProp("defaultColorSchemeIsDark", false); + Session.currentProp("darkModeAvailable", false); }; let switchToAuto = function () { @@ -93,8 +95,10 @@ Have you selected two different themes for your dark/light schemes in user prefe if (window?.matchMedia("(prefers-color-scheme: dark)").matches) { Session.currentProp("defaultColorSchemeIsDark", true); + Session.currentProp("darkModeAvailable", true); } else { Session.currentProp("defaultColorSchemeIsDark", false); + Session.currentProp("darkModeAvailable", false); } }; @@ -198,7 +202,9 @@ Have you selected two different themes for your dark/light schemes in user prefe }, }); - if (settings.add_color_scheme_toggle_to_header) { + // with new sidebar rolling out, this will be the main option of showing + // allow those who dont use sidebar to remove from header + if (!settings.remove_color_scheme_toggle_from_header) { api.addToHeaderIcons("dark-light-toggle"); } @@ -207,6 +213,7 @@ Have you selected two different themes for your dark/light schemes in user prefe click() { toggleDarkLight(); + this.scheduleRerender(); }, html() { @@ -245,6 +252,7 @@ Have you selected two different themes for your dark/light schemes in user prefe } else { switchToAuto(); } + this.scheduleRerender(); }, html() { diff --git a/settings.yml b/settings.yml index cafc938..763da41 100644 --- a/settings.yml +++ b/settings.yml @@ -2,7 +2,7 @@ svg_icons: default: "moon|sun" type: "list" list_type: "compact" -add_color_scheme_toggle_to_header: - default: false +remove_color_scheme_toggle_from_header: + default: true type: bool - description: "Add color scheme toggle button to site header" + description: "Do not show color scheme toggle button in site header"