From f4349d1ae605ecc63f782139b2f8d548f940ae41 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Fri, 10 Nov 2023 17:17:09 +0100 Subject: [PATCH] refactor(colors) and add setting to set dark background to block code --- main.js | 18 ++++++++++++++---- style.css | 6 ++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 2de2709..5c7c85f 100644 --- a/main.js +++ b/main.js @@ -19,7 +19,8 @@ var defaultsettings = password: "", sync: false, tagsinlists: true, - tagfilter: "" + tagfilter: "", + darkcode: true }; //builtin @@ -2013,17 +2014,26 @@ function rawline2html(line, index, options) { options.code = true; options.language = line.substring(3); - line = "
" + line.replace(new RegExp("(" + options.language + ")"), "$1") + "
"; + if (settings.darkcode) + { + line = "
" + line.replace(new RegExp("(" + options.language + ")"), "$1") + "
"; + } } else if (line == "```" && options.code) { options.code = false; options.language = ""; - line = "
" + line + "
"; + if (settings.darkcode) + { + line = "
" + line + "
"; + } } else if (options.code) { - line = "
" + (line || emptyline) + "
"; + if (settings.darkcode) + { + line = "
" + (line || emptyline) + "
"; + } if (languagekeywords[options.language]) { var keywords = languagekeywords[options.language]; diff --git a/style.css b/style.css index 99b4e93..51a28c2 100644 --- a/style.css +++ b/style.css @@ -136,4 +136,10 @@ body::-webkit-scrollbar-thumb { cursor: pointer; background-color: darkgray; margin: 2px 2px 2px 2px; +} + +/* colors */ +.color-code { + color:white; + background-color:black; } \ No newline at end of file