summaryrefslogtreecommitdiff
path: root/searx/static/themes/simple/src/less/code.less
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-09-06 19:12:27 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-09-11 12:27:56 +0200
commit935aed7ca4339a72dc9ace7297d34550e991c6f9 (patch)
tree3d93dbcb238846ac9bda79444bda8dfdb6f32594 /searx/static/themes/simple/src/less/code.less
parent432febd810fb45181a9b575eb71a33fcda9c7703 (diff)
downloadsearxng-935aed7ca4339a72dc9ace7297d34550e991c6f9.tar.gz
searxng-935aed7ca4339a72dc9ace7297d34550e991c6f9.zip
[feature] dark theme for code highlighter in the result list
Closes: https://github.com/searxng/searxng/issues/1354 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/static/themes/simple/src/less/code.less')
-rw-r--r--searx/static/themes/simple/src/less/code.less56
1 files changed, 49 insertions, 7 deletions
diff --git a/searx/static/themes/simple/src/less/code.less b/searx/static/themes/simple/src/less/code.less
index f4e6735ba..d6553feb8 100644
--- a/searx/static/themes/simple/src/less/code.less
+++ b/searx/static/themes/simple/src/less/code.less
@@ -1,9 +1,51 @@
-.code-highlight pre {
- overflow: auto;
- background-color: inherit;
- color: inherit;
- border: inherit;
+@import "../generated/pygments.less";
+
+.codelines {
+ margin: @results-margin 0 0 0;
+ padding: @result-padding 0 0 0;
}
-// stylelint-disable no-invalid-position-at-import-rule
-@import "../generated/pygments.less";
+.code-highlight-sxng() {
+ .code-highlight {
+ pre {
+ overflow: auto;
+ margin: 0;
+ padding: 0 0 0.75rem 0;
+ }
+
+ .linenos {
+ user-select: none;
+ cursor: default;
+
+ &::selection {
+ background: transparent; /* WebKit/Blink Browsers */
+ }
+
+ &::-moz-selection {
+ background: transparent; /* Gecko Browsers */
+ }
+ margin-right: 8px;
+ text-align: right;
+ }
+
+ span.linenos {
+ color: #64708d;
+ }
+ }
+}
+
+.code-highlight-sxng();
+
+/// Dark Theme (autoswitch based on device pref)
+@media (prefers-color-scheme: dark) {
+ :root.theme-auto {
+ .code-highlight-dark();
+ .code-highlight-sxng();
+ }
+}
+
+// Dark Theme by preferences
+:root.theme-dark {
+ .code-highlight-dark();
+ .code-highlight-sxng();
+}