Skip to content

Commit 80c9b6d

Browse files
sneakers-the-ratlwasser
authored andcommitted
Dark mode increased contrast, created pyos variables, added custom css to live rebuild watcher
1 parent 889b582 commit 80c9b6d

File tree

2 files changed

+60
-8
lines changed

2 files changed

+60
-8
lines changed

_static/pyos.css

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/* PyOS-specific vars :) */
2+
:root {
3+
--pyos-color-primary: #703c87;
4+
--pyos-color-secondary: #8045e5;
5+
--pyos-color-secondary-highlight: #591bc2;
6+
--pyos-color-tertiary: #A66C98;
7+
--pyos-color-dark: #542568;
8+
--pyos-color-light: #DAABCF;
9+
10+
/* Darkmode Adjustments*/
11+
--pyos-dm-color-primary: #C483E0;
12+
}
13+
114
html, body {
215
font-size: 1.0rem;
316
}
@@ -37,8 +50,8 @@ h2, h3, h4 {
3750
h1 {
3851
margin-top: 10px;
3952
margin-bottom: 40px;
40-
font-family: 'Itim'!important;
41-
color: #542568;
53+
font-family: 'Itim' !important;
54+
color: var(--pyos-h1-color);
4255
}
4356
h2 {
4457
margin-top: 80px;
@@ -66,6 +79,16 @@ figcaption {
6679
font-size: .9em;
6780
}
6881

82+
/* Navbar */
83+
/*
84+
Don't fill all vertical space beneath TOC, which causes
85+
readthedocs version selector to fall off the page and the
86+
ugly scrollbar to show all the time
87+
*/
88+
.bd-sidebar-primary .sidebar-primary-items__end {
89+
margin-bottom: unset;
90+
margin-top: unset;
91+
}
6992

7093
/* Tutorial block page */
7194
.left-div {
@@ -139,17 +162,17 @@ figcaption {
139162

140163

141164
html[data-theme=light] {
142-
--pst-color-primary: #703c87;
165+
--pst-color-primary: var(--pyos-color-primary);
143166
--pst-color-primary-text: #fff;
144167
--pst-color-primary-highlight: #053f49;
145168
--sd-color-primary: var(--pst-color-primary);
146169
--sd-color-primary-text: var(--pst-color-primary-text);
147170
--sd-color-primary-highlight: var(--pst-color-primary-highlight);
148171
--sd-color-primary-bg: #d0ecf1;
149172
--sd-color-primary-bg-text: #14181e;
150-
--pst-color-secondary: #8045e5;
173+
--pst-color-secondary: var(--pyos-color-secondary);
151174
--pst-color-secondary-text: #fff;
152-
--pst-color-secondary-highlight: #591bc2;
175+
--pst-color-secondary-highlight: var(--pyos-color-secondary-highlight);
153176
--sd-color-secondary: var(--pst-color-secondary);
154177
--sd-color-secondary-text: var(--pst-color-secondary-text);
155178
--sd-color-secondary-highlight: var(--pst-color-secondary-highlight);
@@ -165,5 +188,13 @@ html[data-theme=light] {
165188
--sd-color-success-bg-text: #14181e;
166189
--pst-color-info: #A66C98; /* general admonition */
167190
--pst-color-info-bg: #eac8e2;
168-
--pst-heading-color: #542568;
191+
--pst-heading-color: var(--pyos-color-dark);
192+
--pyos-h1-color: var(--pyos-color-dark);
193+
}
194+
195+
html[data-theme=dark] {
196+
--pst-color-primary: var(--pyos-dm-color-primary);
197+
--pst-color-link: var(--pyos-color-light);
198+
--pst-color-link-hover: var(--pyos-dm-color-primary);
199+
--pyos-h1-color: var(--pyos-color-light);
169200
}

noxfile.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
nox.options.reuse_existing_virtualenvs = True
77

8-
build_command = ["-b", "html", ".", "_build/html"]
8+
OUTPUT_DIR = "_build"
9+
build_command = ["-b", "html", ".", "/".join([OUTPUT_DIR, "/html"])]
910

1011
@nox.session
1112
def docs(session):
@@ -24,10 +25,30 @@ def docs_live(session):
2425
"build_assets",
2526
"tmp",
2627
]
28+
# Explicitly include custom CSS in each build since
29+
# sphinx doesn't think _static files should change since,
30+
# well, they're static.
31+
# Include these as the final `filenames` argument
32+
AUTOBUILD_INCLUDE = [
33+
"_static/pyos.css"
34+
]
35+
36+
# ----------------
37+
# Assemble command
2738
cmd = ["sphinx-autobuild"]
2839
for folder in AUTOBUILD_IGNORE:
2940
cmd.extend(["--ignore", f"*/{folder}/*"])
30-
cmd.extend(build_command + session.posargs)
41+
42+
cmd.extend(build_command)
43+
44+
# use positional arguments if we have them
45+
if len(session.posargs) > 0:
46+
cmd.extend(session.posargs)
47+
# otherwise use default output and include directory
48+
else:
49+
cmd.extend(AUTOBUILD_INCLUDE)
50+
51+
# ----------------
3152
session.run(*cmd)
3253

3354
docs_dir = os.path.join("_build", "html")

0 commit comments

Comments
 (0)