Skip to content

Commit 2359b40

Browse files
authored
docs: modernize the site theme (#3057)
1 parent e4d95e0 commit 2359b40

6 files changed

Lines changed: 108 additions & 7 deletions

File tree

docs/.overrides/.icons/mcp.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/extra.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* Sidebar hierarchy + density for MkDocs Material 9.7.x.
2+
All rules scoped to the desktop sidebar breakpoint (>= 76.25em), matching
3+
Material's own scoping for navigation.sections, so the mobile drill-down
4+
drawer keeps stock styling. Colors use Material tokens, so the light and
5+
slate schemes both work without extra palette handling. */
6+
7+
@media screen and (min-width: 76.25em) {
8+
/* Section labels: smaller, uppercase, letter-spaced, muted. Covers both the
9+
clickable index-page headers and the bare API Reference label. */
10+
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
11+
font-size: 0.62rem;
12+
font-weight: 700;
13+
text-transform: uppercase;
14+
letter-spacing: 0.1em;
15+
color: var(--md-default-fg-color--light);
16+
}
17+
18+
/* Indent section children and hang a guide line. Material outdents section
19+
children with [dir=ltr] ... margin-left: -0.6rem, which is why they sit
20+
flush under the header; restoring the margin re-exposes the stock 0.6rem
21+
list padding. The logical property ties Material's physical one at
22+
(0,3,0) specificity and wins on source order (extra_css loads last),
23+
while staying direction-agnostic. */
24+
.md-sidebar--primary .md-nav__item--section > .md-nav {
25+
margin-inline-start: 0.1rem;
26+
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
27+
}
28+
29+
/* Same guide line for collapsible groups inside the API Reference subtree
30+
(section items also carry --nested, so exclude them). */
31+
.md-sidebar--primary .md-nav__item--nested:not(.md-nav__item--section) > .md-nav {
32+
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
33+
}
34+
35+
/* Tighten vertical rhythm (stock: 0.625em link margins, 1.25em sections).
36+
The child combinator keeps this off anchors inside md-nav__container,
37+
which carry their own margin-top: 0 stock rule. */
38+
.md-sidebar--primary .md-nav__item > .md-nav__link {
39+
margin-top: 0.45em;
40+
}
41+
.md-sidebar--primary .md-nav__item--section {
42+
margin: 1em 0;
43+
}
44+
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
45+
margin-top: 0;
46+
}
47+
48+
/* The current page stands out from its siblings. 700 because Material only
49+
loads Inter at 300/400/700; a 600 would silently substitute the 700 face
50+
anyway, but render lighter on the system-font fallback stack. */
51+
.md-sidebar--primary .md-nav__link--active {
52+
font-weight: 700;
53+
}
54+
55+
/* The sidebar repeats the site name right above the homepage nav entry;
56+
drop the title row on desktop (the mobile drawer still needs it for its
57+
drill-down back-navigation, hence the media-query scope). */
58+
.md-sidebar--primary .md-nav--primary > .md-nav__title {
59+
display: none;
60+
}
61+
}
62+
63+
/* Headings: Material's 300-weight light-gray defaults read washed out; use
64+
the full foreground color and a solid weight instead. 700, not 600: the
65+
Google Fonts request only carries Inter 300/400/700 (see the nav__link
66+
note above). */
67+
.md-typeset h1,
68+
.md-typeset h2 {
69+
font-weight: 700;
70+
color: var(--md-default-fg-color);
71+
}
72+
.md-typeset h3 {
73+
font-weight: 700;
74+
}

docs/favicon.svg

Lines changed: 11 additions & 0 deletions
Loading

mkdocs.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ nav:
6969

7070
theme:
7171
name: "material"
72+
custom_dir: docs/.overrides
73+
font:
74+
text: Inter
75+
code: JetBrains Mono
76+
icon:
77+
logo: mcp
78+
favicon: favicon.svg
7279
palette:
7380
- media: "(prefers-color-scheme)"
7481
scheme: default
@@ -86,7 +93,7 @@ theme:
8693
name: "Switch to dark mode"
8794
- media: "(prefers-color-scheme: dark)"
8895
scheme: slate
89-
primary: white
96+
primary: black
9097
accent: white
9198
toggle:
9299
icon: material/lightbulb-auto-outline
@@ -98,14 +105,20 @@ theme:
98105
- content.code.annotate
99106
- content.code.copy
100107
- content.code.select
101-
- navigation.path
108+
- navigation.footer
102109
- navigation.indexes
110+
- navigation.instant
111+
- navigation.instant.prefetch
112+
- navigation.instant.progress
113+
- navigation.path
114+
- navigation.prune
103115
- navigation.sections
116+
- navigation.top
104117
- navigation.tracking
105118
- toc.follow
106-
# logo: "img/logo-white.svg"
107-
# TODO(Marcelo): Add a favicon.
108-
# favicon: "favicon.ico"
119+
120+
extra_css:
121+
- extra.css
109122

110123
# https://www.mkdocs.org/user-guide/configuration/#validation
111124
validation:

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ docs = [
8080
"mkdocs-gen-files>=0.5.0",
8181
"mkdocs-glightbox>=0.4.0",
8282
"mkdocs-literate-nav>=0.6.1",
83-
"mkdocs-material[imaging]>=9.7.0",
83+
# docs/extra.css overrides Material-internal nav selectors; revisit it on a
84+
# major bump before raising this cap.
85+
"mkdocs-material[imaging]>=9.7.0,<10",
8486
"mkdocstrings-python>=2.0.1",
8587
]
8688
codegen = ["datamodel-code-generator==0.57.0"]

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)