Skip to content

Commit 933c36e

Browse files
committed
Reworked the directory structure and added dark mode
1 parent e669207 commit 933c36e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+241
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# from the environment for the first two.
66
SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
8-
SOURCEDIR = source
8+
SOURCEDIR = .
99
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".
File renamed without changes.

_static/dark_mode.css

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/* Dark mode styles, applied only when body has the dark-mode class */
2+
body.dark-mode {
3+
background-color: #252525; /* Slightly lighter dark gray */
4+
color: #e0e0e0; /* Light gray text */
5+
}
6+
7+
body.dark-mode .wy-nav-top {
8+
background-color: #2b2b2b; /* Darker header */
9+
}
10+
11+
body.dark-mode .wy-nav-side {
12+
background-color: #2b2b2b; /* Dark sidebar */
13+
}
14+
15+
body.dark-mode .wy-menu-vertical a {
16+
color: #e0e0e0; /* Light sidebar links */
17+
}
18+
19+
body.dark-mode .wy-menu-vertical a:hover {
20+
background-color: #3c3c3c; /* Hover effect for general links */
21+
}
22+
23+
body.dark-mode .wy-nav-content {
24+
background-color: #252525; /* Match the body background */
25+
}
26+
27+
body.dark-mode h1,
28+
body.dark-mode h2,
29+
body.dark-mode h3,
30+
body.dark-mode h4,
31+
body.dark-mode h5,
32+
body.dark-mode h6 {
33+
color: #ffffff; /* White headings */
34+
}
35+
36+
body.dark-mode a {
37+
color: #4da8da; /* Light blue links */
38+
}
39+
40+
body.dark-mode a:hover {
41+
color: #66b3ff; /* Lighter blue on hover */
42+
}
43+
44+
body.dark-mode pre {
45+
background-color: #2b2b2b; /* Dark code background */
46+
color: #e0e0e0; /* Light code text */
47+
border: 1px solid #3c3c3c;
48+
}
49+
50+
/* Optional: Style the toggle button */
51+
button {
52+
padding: 8px 16px;
53+
background-color: #4da8da;
54+
color: white;
55+
border: none;
56+
border-radius: 4px;
57+
cursor: pointer;
58+
}
59+
60+
button:hover {
61+
background-color: #66b3ff;
62+
}
63+
64+
body.dark-mode button {
65+
background-color: #2b2b2b;
66+
color: #e0e0e0;
67+
}
68+
69+
body.dark-mode button:hover {
70+
background-color: #3c3c3c;
71+
}
72+
73+
/* Ensure proper layout in wy-breadcrumbs */
74+
.wy-breadcrumbs {
75+
position: relative;
76+
padding: 0 10px;
77+
overflow: hidden; /* Contain floated elements */
78+
white-space: nowrap; /* Prevent wrapping */
79+
}
80+
81+
/* Style <li> elements to stay inline */
82+
.wy-breadcrumbs li {
83+
display: inline-block;
84+
margin-right: 5px;
85+
vertical-align: middle; /* Align breadcrumb items */
86+
}
87+
88+
/* Style wy-breadcrumbs-aside to keep "View page source" on the right */
89+
.wy-breadcrumbs-aside {
90+
float: right; /* Matches theme's default behavior */
91+
display: inline-block;
92+
margin-left: 10px; /* Space from button */
93+
}
94+
95+
/* Ensure "View page source" aligns properly */
96+
.wy-breadcrumbs-aside a {
97+
display: inline-block;
98+
vertical-align: middle;
99+
}
100+
101+
/* Style the button directly in wy-breadcrumbs to stay on the right */
102+
.wy-breadcrumbs button {
103+
float: right; /* Pin to the right */
104+
margin-left: 10px; /* Space from breadcrumb text */
105+
margin-right: 10px; /* Space before "View page source" */
106+
vertical-align: middle; /* Align with other items */
107+
}
108+
109+
/* Keep <a class="icon icon-home">GhostBSD</a> white in both modes */
110+
.wy-side-nav-search .icon.icon-home:not([aria-label="Home"]) {
111+
color: #ffffff; /* White in light mode */
112+
}
113+
114+
body.dark-mode .wy-side-nav-search .icon.icon-home:not([aria-label="Home"]) {
115+
color: #ffffff; /* White in dark mode */
116+
}
117+
118+
/* Fix white background of .toctree-l1.current in dark mode */
119+
body.dark-mode .wy-menu-vertical .toctree-l1.current {
120+
background-color: #3c3c3c; /* Slightly lighter than sidebar */
121+
}
122+
123+
/* Darken background of <a class="reference internal current"> in dark mode */
124+
body.dark-mode .wy-menu-vertical a.reference.internal.current {
125+
background-color: #333333; /* Darker than #3c3c3c */
126+
}
127+
128+
/* Ensure .toctree-l2 <a> fills the li and darkens on hover */
129+
.wy-menu-vertical .toctree-l2 a {
130+
display: block; /* Ensure it fills the li */
131+
}
132+
133+
body.dark-mode .wy-menu-vertical .toctree-l2 a:hover {
134+
background-color: #2a2a2a !important; /* Darker than #3c3c3c, override all */
135+
}
136+
137+
/* Ensure <a> in sidebar fills its parent <li> */
138+
.wy-menu-vertical .toctree-l1 a {
139+
display: block; /* Ensure it fills the li */
140+
}
141+
142+
/* Ensure <a> in toctree-l3 fills its parent <li> */
143+
.wy-menu-vertical .toctree-l3 a {
144+
display: block; /* Ensure it fills the li */
145+
}
146+
147+
/* Darken <a href="#"> inside .toctree-l1.current[aria-expanded="true"] at all times */
148+
body.dark-mode .wy-menu-vertical .toctree-l1.current[aria-expanded="true"] a[href="#"] {
149+
background-color: #2b2b2b; /* Darker than #3c3c3c, constant background */
150+
}
151+
152+
/* Highly specific override for .toctree-l2.current in dark mode */
153+
body.dark-mode .wy-nav-side .wy-menu.wy-menu-vertical ul li.current.toctree-l2 {
154+
background-color: #3c3c3c !important; /* Reordered classes for specificity */
155+
}
156+
157+
/* Ensure li.toctree-l2.current has the correct background in dark mode */
158+
body.dark-mode .wy-menu-vertical li.toctree-l2.current {
159+
background-color: #3c3c3c !important;
160+
}
161+
162+
/* Ensure the <a> inside li.toctree-l2.current does not override the background */
163+
body.dark-mode .wy-menu-vertical li.toctree-l2.current a {
164+
background-color: transparent !important;
165+
}
166+
167+
/* Ensure nested <ul> inside li.toctree-l2.current does not override the background */
168+
body.dark-mode .wy-menu-vertical li.toctree-l2.current ul {
169+
background-color: transparent !important;
170+
}
171+
172+
/* Ensure hover effect for toctree-l3 links in dark mode */
173+
body.dark-mode .wy-nav-side .wy-menu.wy-menu-vertical li.toctree-l3 a:hover {
174+
background-color: #2a2a2a !important; /* Darker than #3c3c3c, override all */
175+
}
176+
177+
/* Prevent parent li.toctree-l3 from interfering with hover effect */
178+
body.dark-mode .wy-menu-vertical li.toctree-l3:hover {
179+
background-color: transparent !important;
180+
}
181+
182+
/* Ensure li.toctree-l3.current has the correct background in dark mode */
183+
body.dark-mode .wy-menu-vertical li.toctree-l3.current {
184+
background-color: #3c3c3c !important; /* Matches toctree-l2.current */
185+
}
186+
187+
/* Ensure the <a> inside li.toctree-l3.current does not override the background */
188+
body.dark-mode .wy-menu-vertical li.toctree-l3.current a {
189+
background-color: transparent !important;
190+
}

_static/dark_mode.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
document.addEventListener('DOMContentLoaded', function () {
2+
const breadcrumbs = document.querySelector('.wy-breadcrumbs');
3+
if (!breadcrumbs) {
4+
console.error('Breadcrumbs element (.wy-breadcrumbs) not found!');
5+
return;
6+
}
7+
8+
const toggleButton = document.createElement('button');
9+
toggleButton.style.marginLeft = '20px';
10+
11+
function updateButtonText() {
12+
toggleButton.textContent = document.body.classList.contains('dark-mode') ? 'Light Mode' : 'Dark Mode';
13+
}
14+
15+
breadcrumbs.appendChild(toggleButton);
16+
17+
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
18+
const savedPreference = localStorage.getItem('darkMode');
19+
20+
if (savedPreference !== null) {
21+
if (savedPreference === 'true') {
22+
document.body.classList.add('dark-mode');
23+
} else {
24+
document.body.classList.remove('dark-mode');
25+
}
26+
} else if (prefersDarkMode) {
27+
document.body.classList.add('dark-mode');
28+
}
29+
30+
updateButtonText();
31+
32+
toggleButton.addEventListener('click', function () {
33+
document.body.classList.toggle('dark-mode');
34+
localStorage.setItem('darkMode', document.body.classList.contains('dark-mode'));
35+
updateButtonText();
36+
});
37+
38+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
39+
if (localStorage.getItem('darkMode') === null) {
40+
document.body.classList.toggle('dark-mode', e.matches);
41+
updateButtonText();
42+
}
43+
});
44+
});
File renamed without changes.

source/conf.py renamed to conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# -- Project information -----------------------------------------------------
1818

1919
project = 'GhostBSD'
20-
copyright = '2021, GhostBSD'
20+
copyright = '2025, GhostBSD'
2121
author = 'Eric Turgeon'
2222

2323

@@ -27,7 +27,8 @@
2727
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2828
# ones.
2929
extensions = [
30-
'myst_parser'
30+
'myst_parser',
31+
'sphinx_rtd_theme'
3132
]
3233

3334
myst_heading_anchors = 3
@@ -61,3 +62,5 @@
6162
# relative to this directory. They are copied after the builtin static files,
6263
# so a file named "default.css" will overwrite the builtin "default.css".
6364
html_static_path = ['_static']
65+
html_css_files = ['dark_mode.css']
66+
html_js_files = ['dark_mode.js']

contributor/index.md

make.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ REM Command file for Sphinx documentation
77
if "%SPHINXBUILD%" == "" (
88
set SPHINXBUILD=sphinx-build
99
)
10-
set SOURCEDIR=source
10+
set SOURCEDIR=.
1111
set BUILDDIR=build
1212

1313
if "%1" == "" goto help
File renamed without changes.

0 commit comments

Comments
 (0)