From 32abf6da526204f0553b87cc84b58d0cdff5ec16 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 25 Mar 2024 12:37:59 -0400 Subject: [PATCH] fix(themer): Set dark mode correctly for preview (#1025) --- inst/themer/themer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inst/themer/themer.js b/inst/themer/themer.js index 0e061ec19..0bb15e0c4 100644 --- a/inst/themer/themer.js +++ b/inst/themer/themer.js @@ -228,7 +228,8 @@ }); $(document).on("change", "#bsthemer-dark-mode", function(ev) { - document.body.dataset.bsTheme = ev.target.checked ? "dark" : "light"; + const colorMode = ev.target.checked ? "dark" : "light"; + document.documentElement.dataset.bsTheme = colorMode; $(window).resize(); });