Skip to content

Commit eb4c33d

Browse files
committed
DOC: Clean up CSS and adapt to new PyData Sphinx Theme version
[skip azp] [skip cirrus]
1 parent ceee998 commit eb4c33d

File tree

4 files changed

+61
-146
lines changed

4 files changed

+61
-146
lines changed

doc/release/upcoming_changes/25908.improvement.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

doc/source/_static/numpy.css

Lines changed: 24 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -9,132 +9,42 @@
99

1010
body {
1111
font-family: 'Open Sans', sans-serif;
12+
font-size: medium;
1213
}
1314

14-
pre, code {
15-
font-size: 100%;
16-
line-height: 155%;
17-
}
18-
19-
h1 {
20-
font-family: "Lato", sans-serif;
21-
color: #013243; /* warm black */
22-
}
23-
24-
h2 {
25-
color: #4d77cf; /* han blue */
26-
letter-spacing: -.03em;
27-
}
28-
29-
h3 {
30-
color: #013243; /* warm black */
31-
letter-spacing: -.03em;
32-
}
33-
34-
/* Style the active version button.
35-
36-
- dev: orange
37-
- stable: green
38-
- old, PR: red
39-
40-
Colors from:
41-
42-
Wong, B. Points of view: Color blindness.
43-
Nat Methods 8, 441 (2011). https://doi.org/10.1038/nmeth.1618
44-
*/
15+
/* Version switcher colors from PyData Sphinx Theme */
4516

46-
/* If the active version has the name "dev", style it orange */
47-
#version_switcher_button[data-active-version-name*="dev"] {
48-
background-color: #E69F00;
49-
border-color: #E69F00;
50-
color:#000000;
51-
}
52-
53-
/* green for `stable` */
54-
#version_switcher_button[data-active-version-name*="stable"] {
55-
background-color: #009E73;
56-
border-color: #009E73;
57-
}
58-
59-
/* red for `old` */
60-
#version_switcher_button:not([data-active-version-name*="stable"], [data-active-version-name*="dev"], [data-active-version-name=""]) {
61-
background-color: #980F0F;
62-
border-color: #980F0F;
17+
.version-switcher__button[data-active-version-name*="dev"] {
18+
background-color: var(--pst-color-warning);
19+
border-color: var(--pst-color-warning);
20+
opacity: 0.9;
6321
}
6422

65-
/* Main page overview cards */
66-
67-
.sd-card {
68-
background: #fff;
69-
border-radius: 0;
70-
padding: 30px 10px 20px 10px;
71-
margin: 10px 0px;
23+
.version-switcher__button:not([data-active-version-name*="stable"]):not([data-active-version-name*="dev"]):not([data-active-version-name*="pull"]) {
24+
background-color: var(--pst-color-danger);
25+
border-color: var(--pst-color-danger);
26+
opacity: 0.9;
7227
}
7328

74-
.sd-card .sd-card-header {
75-
text-align: center;
29+
button.btn.version-switcher__button,
30+
button.btn.version-switcher__button:hover {
31+
color: black;
7632
}
7733

78-
.sd-card .sd-card-header .sd-card-text {
79-
margin: 0px;
80-
}
34+
/* Main index page overview cards */
8135

8236
.sd-card .sd-card-img-top {
83-
height: 52px;
84-
width: 52px;
37+
height: 60px;
38+
width: 60px;
8539
margin-left: auto;
8640
margin-right: auto;
41+
margin-top: 10px;
8742
}
8843

89-
.sd-card .sd-card-header {
90-
border: none;
91-
background-color: white;
92-
color: #150458 !important;
93-
font-size: var(--pst-font-size-h5);
94-
font-weight: bold;
95-
padding: 2.5rem 0rem 0.5rem 0rem;
96-
}
97-
98-
.sd-card .sd-card-footer {
99-
border: none;
100-
background-color: white;
101-
}
102-
103-
.sd-card .sd-card-footer .sd-card-text {
104-
max-width: 220px;
105-
margin-left: auto;
106-
margin-right: auto;
107-
}
44+
/* Main index page overview images */
10845

109-
/* Dark theme tweaking */
11046
html[data-theme=dark] .sd-card img[src*='.svg'] {
111-
filter: invert(0.82) brightness(0.8) contrast(1.2);
112-
}
113-
114-
/* Main index page overview cards */
115-
html[data-theme=dark] .sd-card {
116-
background-color:var(--pst-color-background);
117-
}
118-
119-
html[data-theme=dark] .sd-shadow-sm {
120-
box-shadow: 0 .1rem 1rem rgba(250, 250, 250, .6) !important
121-
}
122-
123-
html[data-theme=dark] .sd-card .sd-card-header {
124-
background-color:var(--pst-color-background);
125-
color: #150458 !important;
126-
}
127-
128-
html[data-theme=dark] .sd-card .sd-card-footer {
129-
background-color:var(--pst-color-background);
130-
}
131-
132-
html[data-theme=dark] h1 {
133-
color: var(--pst-color-primary);
134-
}
135-
136-
html[data-theme=dark] h3 {
137-
color: #0a6774;
47+
filter: invert(0.82) brightness(0.8) contrast(1.2);
13848
}
13949

14050
/* Legacy admonition */
@@ -143,13 +53,12 @@ div.admonition-legacy {
14353
border-color: var(--pst-color-warning);
14454
}
14555

146-
.admonition-legacy.admonition>.admonition-title::before {
56+
.admonition>.admonition-title::after,
57+
div.admonition>.admonition-title::after {
14758
color: var(--pst-color-warning);
148-
content: var(--pst-icon-admonition-attention);
149-
background-color: var(--pst-color-warning);
15059
}
15160

152-
.admonition-legacy.admonition>.admonition-title::after {
153-
color: var(--pst-color-warning);
154-
content: var(--pst-icon-admonition-default);
61+
.admonition>.admonition-title,
62+
div.admonition>.admonition-title {
63+
background-color: var(--pst-color-warning-bg);
15564
}

doc/source/conf.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -239,23 +239,29 @@ def setup(app):
239239
switcher_version = f"{version}"
240240

241241
html_theme_options = {
242-
"logo": {
243-
"image_light": "_static/numpylogo.svg",
244-
"image_dark": "_static/numpylogo_dark.svg",
245-
},
246-
"github_url": "https://github.com/numpy/numpy",
247-
"collapse_navigation": True,
248-
"external_links": [
249-
{"name": "Learn", "url": "https://numpy.org/numpy-tutorials/"},
250-
{"name": "NEPs", "url": "https://numpy.org/neps"}
251-
],
252-
"header_links_before_dropdown": 6,
253-
# Add light/dark mode and documentation version switcher:
254-
"navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
255-
"switcher": {
256-
"version_match": switcher_version,
257-
"json_url": "https://numpy.org/doc/_static/versions.json",
258-
},
242+
"logo": {
243+
"image_light": "_static/numpylogo.svg",
244+
"image_dark": "_static/numpylogo_dark.svg",
245+
},
246+
"github_url": "https://github.com/numpy/numpy",
247+
"collapse_navigation": True,
248+
"external_links": [
249+
{"name": "Learn", "url": "https://numpy.org/numpy-tutorials/"},
250+
{"name": "NEPs", "url": "https://numpy.org/neps"},
251+
],
252+
"header_links_before_dropdown": 6,
253+
# Add light/dark mode and documentation version switcher:
254+
"navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
255+
"navbar_persistent": [],
256+
"switcher": {
257+
"version_match": switcher_version,
258+
"json_url": "https://numpy.org/doc/_static/versions.json",
259+
},
260+
}
261+
262+
html_sidebars = {
263+
"index": "search-button-field",
264+
"**": ["search-button-field", "sidebar-nav-bs"],
259265
}
260266

261267
html_title = "%s v%s Manual" % (project, version)

doc/source/index.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ NumPy documentation
2121
`Historical versions of documentation <https://numpy.org/doc/>`_
2222

2323
**Useful links**:
24-
`Installation <https://numpy.org/install/>`_ |
25-
`Source Repository <https://github.com/numpy/numpy>`_ |
26-
`Issue Tracker <https://github.com/numpy/numpy/issues>`_ |
27-
`Q&A Support <https://numpy.org/gethelp/>`_ |
24+
`Installation <https://numpy.org/install/>`_ |
25+
`Source Repository <https://github.com/numpy/numpy>`_ |
26+
`Issue Tracker <https://github.com/numpy/numpy/issues>`_ |
27+
`Q&A Support <https://numpy.org/gethelp/>`_ |
2828
`Mailing List <https://mail.python.org/mailman/listinfo/numpy-discussion>`_
2929

3030
NumPy is the fundamental package for scientific computing in Python. It is a
@@ -36,13 +36,15 @@ basic statistical operations, random simulation and much more.
3636

3737

3838

39-
.. grid:: 2
39+
.. grid:: 1 1 2 2
40+
:gutter: 2 3 4 4
4041

4142
.. grid-item-card::
4243
:img-top: ../source/_static/index-images/getting_started.svg
44+
:text-align: center
4345

4446
Getting started
45-
^^^^^^^^^^^^^^^
47+
^^^
4648

4749
New to NumPy? Check out the Absolute Beginner's Guide. It contains an
4850
introduction to NumPy's main concepts and links to additional tutorials.
@@ -58,9 +60,10 @@ basic statistical operations, random simulation and much more.
5860

5961
.. grid-item-card::
6062
:img-top: ../source/_static/index-images/user_guide.svg
63+
:text-align: center
6164

6265
User guide
63-
^^^^^^^^^^
66+
^^^
6467

6568
The user guide provides in-depth information on the
6669
key concepts of NumPy with useful background information and explanation.
@@ -76,9 +79,10 @@ basic statistical operations, random simulation and much more.
7679

7780
.. grid-item-card::
7881
:img-top: ../source/_static/index-images/api.svg
82+
:text-align: center
7983

8084
API reference
81-
^^^^^^^^^^^^^
85+
^^^
8286

8387
The reference guide contains a detailed description of the functions,
8488
modules, and objects included in NumPy. The reference describes how the
@@ -96,9 +100,10 @@ basic statistical operations, random simulation and much more.
96100

97101
.. grid-item-card::
98102
:img-top: ../source/_static/index-images/contributor.svg
103+
:text-align: center
99104

100105
Contributor's guide
101-
^^^^^^^^^^^^^^^^^^^
106+
^^^
102107

103108
Want to add to the codebase? Can help add translation or a flowchart to the
104109
documentation? The contributing guidelines will guide you through the

0 commit comments

Comments
 (0)