add dark mode

This commit is contained in:
tdurieux
2021-04-26 14:37:48 +02:00
parent 6164e52eab
commit f58e46fc56
6 changed files with 282 additions and 68 deletions

View File

@@ -295,6 +295,19 @@ angular
.substring(1)
.split("/");
$scope.darkMode = function(on) {
localStorage.setItem("darkMode", on);
$scope.isDarkMode = on;
if (on) {
$("body").addClass("dark-mode");
} else {
$("body").removeClass("dark-mode");
}
$scope.$broadcast("dark-mode", on);
};
$scope.darkMode(localStorage.getItem("darkMode") == "true")
function getUser() {
$http.get("/api/user").then(
(res) => {
@@ -1147,7 +1160,16 @@ angular
_editor.setFadeFoldWidgets($scope.aceOption.fadeFoldWidgets);
},
};
$scope.$on("dark-mode", (event, on) => {
if (on) {
$scope.aceOption.theme = "nord_dark";
} else {
$scope.aceOption.theme = "chrome";
}
});
if ($scope.isDarkMode) {
$scope.aceOption.theme = "nord_dark";
}
$scope.type = getType(extension);
getContent($scope.filePath);