1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-29 23:45:58 -04:00

fix dark/light transitions on syntax highlighting

This commit is contained in:
2021-09-22 17:36:22 -04:00
parent 7353f0b95e
commit 081864d091
2 changed files with 9 additions and 3 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { init as darkModeInit } from "dark-mode-switcheroo";
import { init as initDarkMode } from "dark-mode-switcheroo";
// HACK: disable theme transition until user's preference is auto-restored (1/2)
const disableTransitionCSSHack = document.createElement("style");
@@ -10,7 +10,7 @@ disableTransitionCSSHack.innerHTML = `
}`;
document.head.appendChild(disableTransitionCSSHack);
darkModeInit({
initDarkMode({
toggle: document.querySelector(".dark-mode-toggle"),
onInit: function (t) {
// make toggle visible now that we know JS is enabled
@@ -19,6 +19,6 @@ darkModeInit({
// HACK: re-enable theme transitions after a very short delay, otherwise there's a weird race condition (2/2)
setTimeout(() => {
document.head.removeChild(disableTransitionCSSHack);
}, 250);
}, 500);
},
});