fix(#251): fix notebook and code dark mode

This commit is contained in:
tdurieux
2024-04-04 18:35:01 +01:00
parent f5ec343a9c
commit 8fdd6228e4
5 changed files with 142 additions and 2 deletions

View File

@@ -481,10 +481,22 @@ angular
$scope.darkMode = function (on) {
localStorage.setItem("darkMode", on);
$scope.isDarkMode = on;
const darkPrismLink = "/css/prism-okaidia.css";
const lightPrismLink = "/css/prism.css";
if (on) {
$("body").addClass("dark-mode");
let link = document.createElement("link");
link.href = darkPrismLink;
link.rel = "stylesheet";
document.head.append(link);
$(`link[href='${lightPrismLink}']`).remove();
} else {
$("body").removeClass("dark-mode");
let link = document.createElement("link");
link.href = lightPrismLink;
link.rel = "stylesheet";
document.head.append(link);
$(`link[href='${darkPrismLink}']`).remove();
}
$scope.$broadcast("dark-mode", on);
};