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