Skip to content

Commit d61ed46

Browse files
authored
🔧 Add sphinx-immaterial to doc theme builds (#190)
1 parent 9412892 commit d61ed46

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

docs/_static/sphinx_immaterial.css

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
body {
2+
--sd-fontsize-dropdown: .64rem;
3+
--sd-fontsize-dropdown-title: .64rem;
4+
--sd-fontweight-dropdown-title: 700;
5+
}
6+
7+
details.sd-dropdown {
8+
padding-left: 0;
9+
padding-right: 0;
10+
}
11+
12+
summary.sd-summary-title::after {
13+
display: none;
14+
right: 0 !important;
15+
}
16+
17+
summary.sd-summary-title::before {
18+
display: none;
19+
left: 0 !important;
20+
}
21+
22+
summary.sd-summary-title {
23+
width: 100% !important;
24+
margin-left: 0;
25+
padding: .5em 1em !important;
26+
}
27+
28+
summary.sd-summary-title svg.sd-octicon {
29+
max-width: none !important;
30+
}

docs/conf.py

+33
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,39 @@
5555
html_theme_options = {
5656
"logo_only": True,
5757
}
58+
if html_theme == "sphinx_immaterial":
59+
extensions.append("sphinx_immaterial")
60+
html_css_files = ["sphinx_immaterial.css"]
61+
html_theme_options = {
62+
"icon": {
63+
"repo": "fontawesome/brands/github",
64+
},
65+
"site_url": "https://sphinx-design.readthedocs.io/",
66+
"repo_url": "https://github.com/executablebooks/sphinx-design",
67+
"repo_name": "Sphinx-Design",
68+
"palette": [
69+
{
70+
"media": "(prefers-color-scheme: light)",
71+
"scheme": "default",
72+
"primary": "blue",
73+
"accent": "light-blue",
74+
"toggle": {
75+
"icon": "material/weather-night",
76+
"name": "Switch to dark mode",
77+
},
78+
},
79+
{
80+
"media": "(prefers-color-scheme: dark)",
81+
"scheme": "slate",
82+
"primary": "blue",
83+
"accent": "yellow",
84+
"toggle": {
85+
"icon": "material/weather-sunny",
86+
"name": "Switch to light mode",
87+
},
88+
},
89+
],
90+
}
5891

5992
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
6093
myst_enable_extensions = ["colon_fence", "deflist", "substitution", "html_image"]

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ theme-furo = ["furo~=2024.5.4"]
4848
theme-pydata = ["pydata-sphinx-theme~=0.15.2"]
4949
theme-rtd = ["sphinx-rtd-theme~=2.0"]
5050
theme-sbt = ["sphinx-book-theme~=1.1"]
51+
theme-im = ["sphinx-immaterial~=0.11.11"]
5152

5253
[tool.flit.sdist]
5354
exclude = [

tox.ini

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# To use tox, see https://tox.readthedocs.io
2-
# Simply pip or conda install tox
3-
# If you use conda, you may also want to install tox-conda
2+
# (you may also want to install tox-uv)
43
# then run `tox` or `tox -- {pytest args}`
54
# run in parallel using `tox -p`
65
[tox]
@@ -15,7 +14,7 @@ extras =
1514
testing
1615
commands = pytest {posargs}
1716

18-
[testenv:docs-{alabaster,rtd,pydata,sbt,furo}]
17+
[testenv:docs-{alabaster,rtd,pydata,sbt,furo,im}]
1918
description =
2019
Run documentation build for this theme
2120
extras =
@@ -24,6 +23,7 @@ extras =
2423
pydata: theme_pydata
2524
sbt: theme_sbt
2625
furo: theme_furo
26+
im: theme_im
2727
allowlist_externals = echo
2828
passenv =
2929
BUILDER
@@ -35,6 +35,7 @@ setenv =
3535
pydata: SPHINX_THEME = pydata_sphinx_theme
3636
sbt: SPHINX_THEME = sphinx_book_theme
3737
furo: SPHINX_THEME = furo
38+
im: SPHINX_THEME = sphinx_immaterial
3839
commands_pre =
3940
python -c "import shutil; shutil.rmtree('docs/_build/{env:BUILDER:html}/{env:SPHINX_THEME:}', ignore_errors=True) if '{env:CLEAN:}' else None"
4041
commands =

0 commit comments

Comments
 (0)