From 0adabd1ba38c8ff6a3c8b64cb4e38a41c3a26296 Mon Sep 17 00:00:00 2001 From: rattatwinko Date: Sat, 27 Sep 2025 22:51:39 +0200 Subject: [PATCH] dark mode. this works ok. not too good but yeah it does. --- PyPost.py | 7 ++- css/main.css | 86 +++++++++++++++++++++++++ html/base/index.html | 145 +++++++++++++++++++++++++++++-------------- js/shared/theme.js | 11 ++++ 4 files changed, 200 insertions(+), 49 deletions(-) create mode 100644 js/shared/theme.js diff --git a/PyPost.py b/PyPost.py index 899b895..4ed3f03 100644 --- a/PyPost.py +++ b/PyPost.py @@ -32,7 +32,7 @@ if not RUST_PARSER_PATH.exists(): markdown_parser = marko.Markdown(extensions=[GFM]) # Threshold for switching to Rust parser (number of lines) -RUST_PARSER_THRESHOLD = 500 +RUST_PARSER_THRESHOLD = 1000 Logger = Logger() @@ -136,6 +136,7 @@ def render_markdown(md_path: Path): + @@ -146,8 +147,8 @@ def render_markdown(md_path: Path): Back {title} - write_img -
Written @{time.asctime(time.localtime())}
+ write_img +
Written @{time.asctime(time.localtime())}

diff --git a/css/main.css b/css/main.css index 75b6bcb..2c7c6d0 100644 --- a/css/main.css +++ b/css/main.css @@ -168,6 +168,92 @@ background-position: center; } +code[class*="language-"], +pre[class*="language-"] { + text-shadow: none !important; + color: inherit; /* optional: respect your theme */ +} + +.language-css .token.string, +.style .token.string, +.token.entity, +.token.operator, +.token.url { + background: none !important; + color: inherit; /* keep your color, or override further */ +} + +/* Dark mode */ +body.dark-mode { + background: #121212; + color: #e0e0e0; +} + +body.dark-mode a { color: #80b3ff; } +body.dark-mode a:hover { color: #a3c8ff; } + +body.dark-mode th, +body.dark-mode td { + border-color: #444; +} +body.dark-mode th { + background: #1e1e1e; +} + +body.dark-mode code, +body.dark-mode pre { + background: #1e1e1e; + color: #c8c8c8; +} + +body.dark-mode blockquote { + border-left-color: #555; + color: #bbb; +} + +body.dark-mode input, +body.dark-mode select, +body.dark-mode textarea, +body.dark-mode button { + background: #1e1e1e; + color: #e0e0e0; + border: 1px solid #555; +} +body.dark-mode button { + background: #2a2a2a; +} +body.dark-mode button:hover { + background: #333; +} + +/* Alerts in dark mode */ +body.dark-mode .html-content .alert-note { + background: #1a2433; + color: #80b3ff; + border-color: #80b3ff; +} +body.dark-mode .html-content .alert-tip { + background: #13291b; + color: #6ede8a; + border-color: #6ede8a; +} +body.dark-mode .html-content .alert-important { + background: #241833; + color: #c29fff; + border-color: #c29fff; +} +body.dark-mode .html-content .alert-warning { + background: #2a200f; + color: #ffcc66; + border-color: #ffcc66; +} +body.dark-mode .html-content .alert-caution { + background: #2a1518; + color: #ff8080; + border-color: #ff8080; +} + + /* INFO */ .html-content .alert-note p:first-child::before { background-image: url("data:image/svg+xml;utf8,\ diff --git a/html/base/index.html b/html/base/index.html index 937e745..76fc911 100644 --- a/html/base/index.html +++ b/html/base/index.html @@ -3,7 +3,72 @@ Auto Index - + @@ -80,7 +130,7 @@

Please enable Javascript!

- If you might be wondering, what does the Script do?
+ If you might be wondering, what does the Script do?