From b1feb7e5c88394066375056342f7c2fecba99bf7 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:06:04 -0500 Subject: [PATCH] Bugfix for custom css, adjust custom css for easier logo --- yardang/build.py | 4 ++-- yardang/custom.css | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/yardang/build.py b/yardang/build.py index 333b2e6..d2b2ea8 100644 --- a/yardang/build.py +++ b/yardang/build.py @@ -70,8 +70,8 @@ def generate_docs_configuration( pages = pages or get_config(section="pages", base=config_base) or [] use_autoapi = use_autoapi or get_config(section="use-autoapi", base=config_base) - custom_css = custom_css or get_config(section="custom-css", base=config_base) or (Path(__file__).parent / "custom.css") - custom_js = custom_js or get_config(section="custom-js", base=config_base) or (Path(__file__).parent / "custom.js") + custom_css = custom_css or Path(get_config(section="custom-css", base=config_base) or (Path(__file__).parent / "custom.css")) + custom_js = custom_js or Path(get_config(section="custom-js", base=config_base) or (Path(__file__).parent / "custom.js")) source_dir = os.path.curdir diff --git a/yardang/custom.css b/yardang/custom.css index dcf83cb..87e9476 100644 --- a/yardang/custom.css +++ b/yardang/custom.css @@ -9,4 +9,38 @@ aside.sidebar-drawer { /* Left-align tables */ article table.align-default { margin-left: 0; -} \ No newline at end of file +} + +/* Handle logo switching for light/dark themes */ +/* Put in code like: + + nbprint + + + nbprint + +*/ +body[data-theme="light"] .logo-light { + display: inline; +} +body[data-theme="light"] .logo-dark { + display: none; +} +body[data-theme="dark"] .logo-light { + display: none; +} +body[data-theme="dark"] .logo-dark { + display: inline; +} + +@media (prefers-color-scheme: dark) { + .logo-light { + display: none; + } +} + +@media (prefers-color-scheme: light) { + .logo-dark { + display: none; + } +}