xref: /aosp_15_r20/external/pigweed/docs/_static/css/pigweed.css (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1/*
2 * Copyright 2024 The Pigweed Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 *     https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17/********** General document and node styles ***********/
18/* Note: The final value of color variables like --pw-color-background-code
19 * is resolved when dark theme or light theme is chosen. */
20
21:root {
22  /* PyData Sphinx Theme variables. */
23  /* When you move your mouse over a table, pydata highlights the row that
24   * you're currently hovering over. Make this highlight color more muted. */
25  --pst-color-table-row-hover-bg: var(--sd-color-primary-bg) !important;
26  /* Pigweed variables. */
27  --pw-font-body: "Noto Sans", sans-serif;
28  --pw-font-code: "Roboto Mono", monospace;
29  --pw-font-headings: "Lato", sans-serif;
30  /* All nodes should always scroll instantly. */
31  scroll-behavior: auto !important;
32  --font-stack-monospace: var(--pw-font-code);
33}
34
35code {
36  /* Remove borders from inline code (i.e. code that appears within
37   * paragraphs. Note that code blocks should have borders; those are
38   * applied to the code block's pre element. */
39  border: none !important;
40}
41
42code, pre {
43  background-color: var(--pw-color-background-code);
44  color: var(--pw-color-foreground-primary);
45  font-family: var(--pw-font-code);
46}
47
48div, li, p {
49  font-family: var(--pw-font-body);
50}
51
52h1, h2, h3, h4, h5, h6 {
53  font-family: var(--pw-font-headings);
54  font-weight: bold;
55}
56
57/* Highlighted lines in code blocks. */
58.highlight .hll {
59  /* Make highlighted code easier to read. */
60  background-color: var(--color-code-hll-background) !important;
61}
62
63/********** Dark mode styles ***********/
64/* https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/styling.html#color-variables */
65
66html[data-theme="dark"] {
67  /* PyData Sphinx Theme variables. */
68  --pst-color-primary: #fb71fe;
69  --pst-color-secondary: #8be9fd;
70  /* Pigweed variables. */
71  --pw-color-link: #2b8cee;
72  --pw-color-link-inactive: #9ca0a5;
73  --pw-color-background-primary: #1c2128;
74  --pw-color-background-secondary: #22272e;
75  --pw-color-background-code: #2d333b;
76  --pw-color-foreground-primary: #ffffffcc;
77  /* Doxygen/Breathe API reference customizations. */
78  --color-api-function-border: #575757;
79  --color-api-function-background: #2b2b2b;
80  --color-api-class-background: #222c35;
81  --color-api-class-foreground: #87c1e5;
82  --color-api-class-border: #5288be;
83  --color-code-hll-background: #ffc55140;
84}
85
86/********** Light mode styles ***********/
87/* https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/styling.html#color-variables */
88
89html[data-theme="light"] {
90  /* PyData Sphinx Theme variables. */
91  --pst-color-primary: #b529aa;
92  --pst-color-secondary: #016074;
93  /* Pigweed variables. */
94  --pw-color-link: #2a5adf;
95  --pw-color-link-inactive: #9ca0a5;
96  --pw-color-background-primary: #ffffff;
97  --pw-color-background-secondary: #f8f9fb;
98  --pw-color-background-code: #f8f8f8;
99  --pw-color-foreground-primary: ;
100  /* Doxygen/Breathe API reference customizations. */
101  --color-api-function-border: #cccccc;
102  --color-api-function-background: #f0f0f0;
103  --color-api-class-background: #e7f2fa;
104  --color-api-class-foreground: #2980b9;
105  --color-api-class-border: #6ab0de;
106  --color-code-hll-background: #ffffcc;
107}
108
109/********** pydata customizations ***********/
110/* These classes either come from our theme (pydata-sphinx-theme)
111 * or Sphinx extensions that pydata relies on. */
112
113/* Announcement banner. Only visible when an announcement is set in conf.py.
114 * Is displayed at the very top of the page when enabled.
115 * https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html */
116.bd-header-announcement {
117  background-color: #00a100;
118  font-family: var(--pw-font-body);
119  font-style: italic;
120  a {
121    color: var(--pst-color-light);
122    font-weight: bold;
123  }
124}
125
126/* Header container at the top of every page that contains the logo,
127 * top-level nav, search box, theme switcher, and social links. */
128.bd-header {
129  background-color: var(--pw-color-background-secondary) !important;
130  font-family: var(--pw-font-headings);
131  .logo__title {
132    font-size: 1.25em;
133    font-family: "Lato", sans-serif;
134    font-weight: bold;
135    font-style: italic;
136    color: var(--pst-color-primary);
137  }
138  /* Top-level nav links. */
139  .nav-item {
140    color: var(--pw-color-link-inactive);
141    /* On medium-width screens keep the text on a single row. */
142    white-space: nowrap;
143    /* The currently visible top-level section. */
144    .active {
145      color: var(--pst-color-primary);
146    }
147    :hover {
148      color: var(--pst-color-secondary);
149    }
150  }
151  .search-button__default-text {
152    font-family: var(--pw-font-body);
153  }
154  /* Theme toggle button. */
155  .theme-switch-button:hover {
156    color: var(--pst-color-secondary);
157  }
158}
159
160/* Search modal wrapper. The search modal is displayed after
161 * focusing the search box in the header or pressing Ctrl+K. */
162.search-button__search-container {
163  /* Most of these tweaks are related to making our custom inline search
164   * results container (.pw-search-results) display correctly. */
165  background-color: var(--pst-color-background);
166  flex-direction: column;
167  height: 50vh;
168  .bd-search {
169    flex-grow: 0 !important;
170  }
171  /* Pigweed-custom search results container that we append
172   * after the search modal input. Search results are populated
173   * into this container. This enables you to see search results
174   * immediately after typing rather than needing to press Enter
175   * and go to the search results page.
176   *
177   * TODO: b/363034219 - Remove this custom code. */
178  .pw-search-results {
179    overflow-y: scroll;
180    padding: 1em;
181    a {
182      color: var(--pw-color-link);
183    }
184  }
185}
186
187/* Container for the primary sidebar, main content,
188 * and secondary sidebar. */
189.bd-container {
190  background-color: var(--pw-color-background-primary);
191}
192
193/* Breadcrumbs that appear above the main content. */
194.bd-breadcrumbs {
195  font-family: var(--pw-font-headings);
196}
197
198/* "Section Navigation" container that appears to the left of
199 * the main content. */
200.bd-sidebar-primary {
201  background-color: var(--pw-color-background-primary);
202  font-family: var(--pw-font-body);
203  /* Hide the "Section Navigation" scrollbar. */
204  scrollbar-width: none;
205  -ms-overflow-style: none;
206  ::-webkit-scrollbar {
207    display: none;
208  }
209}
210
211/* Main content of the page. */
212.bd-article {
213  color: var(--pw-color-foreground-primary);
214  /* Links */
215  a.reference {
216    color: var(--pw-color-link);
217  }
218  dd.field-odd {
219    margin-inline-start: 0;
220    padding-inline-start: 0;
221  }
222}
223
224/* Container with "Previous" and "Next" links that appears at the
225 * end of the main content. */
226.prev-next-footer {
227  .prev-next-title {
228    color: var(--pw-color-link);
229  }
230}
231
232/* "On this page" container that appears to the right of the main
233 * content. */
234.bd-sidebar-secondary {
235  background-color: var(--pw-color-background-primary);
236  font-family: var(--pw-font-body);
237  /* Links to jump to sections on this page. */
238  .nav-item {
239    color: var(--pw-color-link-inactive);
240    /* The currently visible section. */
241    .active {
242      color: var(--pst-color-primary);
243    }
244  }
245}
246
247/* Footer container at the very bottom of every page. */
248.bd-footer {
249  background-color: var(--pw-color-background-secondary);
250  font-family: var(--pw-font-body);
251  a {
252    color: var(--pw-color-link);
253  }
254}
255
256/********** sphinx-design component customizations ***********/
257/* Sphinx Design provides common UI components like cards, tabs, etc.
258 * https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/web-components.html */
259
260/* Tab customizations.*/
261
262.sd-tab-content {
263  /* Tones down the border (the default is distracting). */
264  border: 2px solid var(--pst-color-border) !important;
265}
266
267.sd-tab-label {
268  /* Tones down the border (the default is distracting). */
269  border-bottom: none !important;
270  border-color: var(--pst-color-border) !important;
271  border-width: 2px !important;
272}
273
274/* Card customizations. */
275
276.sales-pitch-cta-primary {
277  .sd-card-title {
278    border-bottom: 3px solid var(--pst-color-primary);
279    padding-bottom: 0.5rem;
280  }
281}
282
283.sales-pitch-cta-secondary {
284  .sd-card-title {
285    border-bottom: 3px solid var(--pst-color-secondary);
286    padding-bottom: 0.5rem;
287  }
288}
289
290/********** Pigweed component customizations ***********/
291
292/* Pigweed module cards styles. At the top of Pigweed module docs
293 * we often display a card that displays metadata about the module,
294 * e.g. tagline, supported languages, status of the module, etc.
295 * See also: //pw_docgen/py/pw_docgen/sphinx/module_metadata.py */
296
297.pw-topnav {
298  background-color: var(--color-background-primary);
299  padding: 0;
300  width: 100%;
301}
302
303.pw-topnav-inline {
304  display: flex;
305  flex-direction: row;
306  padding: 1em 0 0 0;
307}
308
309.pw-topnav-inline h1 {
310  padding: 0;
311  margin: 0;
312}
313
314.pw-topnav-title {
315  font-size: 2.5em;
316  font-weight: 700;
317  line-height: 1.25;
318  padding: 0;
319  margin: 0;
320}
321
322.pw-topnav-subtitle {
323  display: block;
324  font-size: larger;
325  font-weight: bold;
326  margin: 0.75em 0 0.5em 0;
327  padding: 0;
328}
329
330.pw-text-center-align {
331    text-align: center
332}
333
334.pw-module-section-nav-group {
335  display: flex;
336  margin: 0 1em;
337  padding: 0;
338}
339
340.pw-module-section-nav-link {
341  display: inline;
342  list-style-type: none;
343  margin: auto;
344  padding: 0 1em;
345}
346
347.pw-module-section-nav-link p {
348  display: inline;
349  font-size: large;
350}
351
352/********** Doxygen/Breathe customizations ***********/
353/* We use Doxygen and Breathe to auto-generate our C/C++
354 * API references. The next styles tweak the auto-generated
355 * HTML and CSS. */
356
357/* TODO: b/364322974 - Re-tweak Doxygen/Breathe-related styles. */
358