From 55bb87884a5a88b70e4368ef90b568b49cc39afe Mon Sep 17 00:00:00 2001 From: cydia2001 Date: Tue, 10 Mar 2026 22:31:14 +0000 Subject: [PATCH] feat: add dark mode image background for mdbook dark themes Co-Authored-By: Claude Opus 4.6 --- book.toml | 1 + theme/dark-mode-images.css | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 theme/dark-mode-images.css diff --git a/book.toml b/book.toml index 614bac6..a9fa90f 100644 --- a/book.toml +++ b/book.toml @@ -15,3 +15,4 @@ command = "python3 tools/mdbook_zh_preprocessor.py" git-repository-url = "https://github.com/openmlsys/openmlsys-zh" mathjax-support = true preferred-dark-theme = "navy" +additional-css = ["theme/dark-mode-images.css"] diff --git a/theme/dark-mode-images.css b/theme/dark-mode-images.css new file mode 100644 index 0000000..43917b8 --- /dev/null +++ b/theme/dark-mode-images.css @@ -0,0 +1,8 @@ +/* 暗色模式下为图片添加浅灰色背景,提高透明背景图片的可读性 */ +.navy img, +.coal img, +.ayu img { + background-color: #e8e8e8; + border-radius: 4px; + padding: 8px; +}