Skip to content

Commit 4b5eeb3

Browse files
authored
Merge pull request #66 from python-project-templates/tkp/cus
Bugfix for custom css, adjust custom css for easier logo
2 parents 47fa85c + b1feb7e commit 4b5eeb3

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

yardang/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def generate_docs_configuration(
7070
pages = pages or get_config(section="pages", base=config_base) or []
7171
use_autoapi = use_autoapi or get_config(section="use-autoapi", base=config_base)
7272

73-
custom_css = custom_css or get_config(section="custom-css", base=config_base) or (Path(__file__).parent / "custom.css")
74-
custom_js = custom_js or get_config(section="custom-js", base=config_base) or (Path(__file__).parent / "custom.js")
73+
custom_css = custom_css or Path(get_config(section="custom-css", base=config_base) or (Path(__file__).parent / "custom.css"))
74+
custom_js = custom_js or Path(get_config(section="custom-js", base=config_base) or (Path(__file__).parent / "custom.js"))
7575

7676
source_dir = os.path.curdir
7777

yardang/custom.css

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,38 @@ aside.sidebar-drawer {
99
/* Left-align tables */
1010
article table.align-default {
1111
margin-left: 0;
12-
}
12+
}
13+
14+
/* Handle logo switching for light/dark themes */
15+
/* Put in code like:
16+
<a class="logo-light" href="https://github.com/nbprint/nbprint#gh-light-mode-only">
17+
<img src="https://github.com/nbprint/nbprint/raw/main/docs/img/logo-light.png?raw=true#gh-light-mode-only" alt="nbprint" width="400"></a>
18+
</a>
19+
<a class="logo-dark" href="https://github.com/nbprint/nbprint#gh-dark-mode-only">
20+
<img src="https://github.com/nbprint/nbprint/raw/main/docs/img/logo-dark.png?raw=true#gh-dark-mode-only" alt="nbprint" width="400"></a>
21+
</a>
22+
*/
23+
body[data-theme="light"] .logo-light {
24+
display: inline;
25+
}
26+
body[data-theme="light"] .logo-dark {
27+
display: none;
28+
}
29+
body[data-theme="dark"] .logo-light {
30+
display: none;
31+
}
32+
body[data-theme="dark"] .logo-dark {
33+
display: inline;
34+
}
35+
36+
@media (prefers-color-scheme: dark) {
37+
.logo-light {
38+
display: none;
39+
}
40+
}
41+
42+
@media (prefers-color-scheme: light) {
43+
.logo-dark {
44+
display: none;
45+
}
46+
}

0 commit comments

Comments
 (0)