Debian Codegraph @

crates/mdbook-html/front-end/css/chrome.css

raw
1 /* CSS for UI elements (a.k.a. chrome) */
2
3 html {
4 scrollbar-color: var(--scrollbar) transparent;
5 }
6 #mdbook-searchresults a,
7 .content a:link,
8 a:visited,
9 a > .hljs {
10 color: var(--links);
11 }
12
13 /*
14 mdbook-body-container is necessary because mobile browsers don't seem to like
15 overflow-x on the body tag when there is a <meta name="viewport"> tag.
16 */
17 #mdbook-body-container {
18 /*
19 This is used when the sidebar pushes the body content off the side of
20 the screen on small screens. Without it, dragging on mobile Safari
21 will want to reposition the viewport in a weird way.
22 */
23 overflow-x: clip;
24 }
25
26 /* Menu Bar */
27
28 #mdbook-menu-bar,
29 #mdbook-menu-bar-hover-placeholder {
30 z-index: 101;
31 margin: auto calc(0px - var(--page-padding));
32 }
33 #mdbook-menu-bar {
34 position: relative;
35 display: flex;
36 flex-wrap: wrap;
37 background-color: var(--bg);
38 border-block-end-color: var(--bg);
39 border-block-end-width: 1px;
40 border-block-end-style: solid;
41 }
42 #mdbook-menu-bar.sticky,
43 #mdbook-menu-bar-hover-placeholder:hover + #mdbook-menu-bar,
44 #mdbook-menu-bar:hover,
45 html.sidebar-visible #mdbook-menu-bar {
46 position: -webkit-sticky;
47 position: sticky;
48 top: 0 !important;
49 }
50 #mdbook-menu-bar-hover-placeholder {
51 position: sticky;
52 position: -webkit-sticky;
53 top: 0;
54 height: var(--menu-bar-height);
55 }
56 #mdbook-menu-bar.bordered {
57 border-block-end-color: var(--table-border-color);
58 }
59 #mdbook-menu-bar .fa-svg, #mdbook-menu-bar .icon-button {
60 position: relative;
61 padding: 0 8px;
62 z-index: 10;
63 line-height: var(--menu-bar-height);
64 cursor: pointer;
65 transition: color 0.5s;
66 }
67 @media only screen and (max-width: 420px) {
68 #mdbook-menu-bar .fa-svg, #mdbook-menu-bar .icon-button {
69 padding: 0 5px;
70 }
71 }
72
73 .icon-button {
74 border: none;
75 background: none;
76 padding: 0;
77 color: inherit;
78 }
79 .icon-button .fa-svg {
80 margin: 0;
81 }
82
83 .right-buttons {
84 margin: 0 15px;
85 }
86 .right-buttons a {
87 text-decoration: none;
88 }
89
90 .left-buttons {
91 display: flex;
92 margin: 0 5px;
93 }
94 html:not(.js) .left-buttons button {
95 display: none;
96 }
97
98 .menu-title {
99 display: inline-block;
100 font-weight: 200;
101 font-size: 2.4rem;
102 line-height: var(--menu-bar-height);
103 text-align: center;
104 margin: 0;
105 flex: 1;
106 white-space: nowrap;
107 overflow: hidden;
108 text-overflow: ellipsis;
109 }
110 .menu-title {
111 cursor: pointer;
112 }
113
114 .menu-bar,
115 .menu-bar:visited,
116 .nav-chapters,
117 .nav-chapters:visited,
118 .mobile-nav-chapters,
119 .mobile-nav-chapters:visited,
120 .menu-bar .icon-button,
121 .menu-bar a .fa-svg {
122 color: var(--icons);
123 }
124
125 .menu-bar .fa-svg:hover,
126 .menu-bar .icon-button:hover,
127 .nav-chapters:hover,
128 .mobile-nav-chapters .fa-svg:hover {
129 color: var(--icons-hover);
130 }
131
132 /* Nav Icons */
133
134 .nav-chapters {
135 font-size: 2.5em;
136 text-align: center;
137 text-decoration: none;
138
139 position: fixed;
140 top: 0;
141 bottom: 0;
142 margin: 0;
143 max-width: 150px;
144 min-width: 90px;
145
146 display: flex;
147 justify-content: center;
148 align-content: center;
149 flex-direction: column;
150
151 transition: color 0.5s, background-color 0.5s;
152 }
153
154 .nav-chapters:hover {
155 text-decoration: none;
156 background-color: var(--theme-hover);
157 transition: background-color 0.15s, color 0.15s;
158 }
159
160 .nav-chapters.previous {
161 /* Ensure that the previous arrow does not overlap the resize indicator. */
162 margin-inline-start: var(--sidebar-resize-indicator-width);
163 }
164
165 .nav-wrapper {
166 margin-block-start: 50px;
167 display: none;
168 }
169
170 .mobile-nav-chapters {
171 font-size: 2.5em;
172 text-align: center;
173 text-decoration: none;
174 width: 90px;
175 border-radius: 5px;
176 background-color: var(--sidebar-bg);
177 }
178
179 /* Only Firefox supports flow-relative values */
180 .previous { float: left; }
181 [dir=rtl] .previous { float: right; }
182
183 /* Only Firefox supports flow-relative values */
184 .next {
185 float: right;
186 right: var(--page-padding);
187 }
188 [dir=rtl] .next {
189 float: left;
190 right: unset;
191 left: var(--page-padding);
192 }
193
194 @media only screen and (max-width: 1080px) {
195 .nav-wide-wrapper { display: none; }
196 .nav-wrapper { display: block; }
197 }
198
199 /* sidebar-visible */
200 @media only screen and (max-width: 1380px) {
201 #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wide-wrapper { display: none; }
202 #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wrapper { display: block; }
203 }
204
205 /* Inline code */
206
207 :not(pre) > .hljs {
208 display: inline;
209 padding: 0.1em 0.3em;
210 border-radius: 3px;
211 }
212
213 :not(pre):not(a) > .hljs {
214 color: var(--inline-code-color);
215 overflow-x: initial;
216 }
217
218 a:hover > .hljs {
219 text-decoration: underline;
220 }
221
222 pre {
223 position: relative;
224 }
225 pre > .buttons {
226 position: absolute;
227 z-index: 100;
228 right: 0px;
229 top: 2px;
230 margin: 0px;
231 padding: 2px 0px;
232
233 color: var(--sidebar-fg);
234 cursor: pointer;
235 visibility: hidden;
236 opacity: 0;
237 transition: visibility 0.1s linear, opacity 0.1s linear;
238 }
239 pre:hover > .buttons {
240 visibility: visible;
241 opacity: 1
242 }
243 pre > .buttons :hover {
244 color: var(--sidebar-active);
245 border-color: var(--icons-hover);
246 background-color: var(--theme-hover);
247 }
248 pre > .buttons button {
249 cursor: inherit;
250 margin: 0px 5px;
251 padding: 2px 3px 0px 4px;
252 font-size: 23px;
253
254 border-style: solid;
255 border-width: 1px;
256 border-radius: 4px;
257 border-color: var(--icons);
258 background-color: var(--theme-popup-bg);
259 transition: 100ms;
260 transition-property: color,border-color,background-color;
261 color: var(--icons);
262 }
263
264 pre > .buttons button.clip-button {
265 padding: 2px 4px 0px 6px;
266 }
267 pre > .buttons button.clip-button::before {
268 /* clipboard image from octicons (https://github.com/primer/octicons/tree/v2.0.0) MIT license
269 */
270 content: url('data:image/svg+xml,<svg width="21" height="20" viewBox="0 0 24 25" \
271 xmlns="http://www.w3.org/2000/svg" aria-label="Copy to clipboard">\
272 <path d="M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 \
273 0110 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v14h16v-3zM3 \
274 7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.666C11.75 2.755 10.957 2 10 \
275 2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"/>\
276 <path d="M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"/>\
277 </svg>');
278 filter: var(--copy-button-filter);
279 }
280 pre > .buttons button.clip-button:hover::before {
281 filter: var(--copy-button-filter-hover);
282 }
283
284 @media (pointer: coarse) {
285 pre > .buttons button {
286 /* On mobile, make it easier to tap buttons. */
287 padding: 0.3rem 1rem;
288 }
289
290 .sidebar-resize-indicator {
291 /* Hide resize indicator on devices with limited accuracy */
292 display: none;
293 }
294 }
295 pre > code {
296 display: block;
297 padding: 1rem;
298 }
299
300 /* FIXME: ACE editors overlap their buttons because ACE does absolute
301 positioning within the code block which breaks padding. The only solution I
302 can think of is to move the padding to the outer pre tag (or insert a div
303 wrapper), but that would require fixing a whole bunch of CSS rules.
304 */
305 .hljs.ace_editor {
306 padding: 0rem 0rem;
307 }
308
309 pre > .result {
310 margin-block-start: 10px;
311 }
312
313 /* Search */
314
315 #mdbook-searchresults a {
316 text-decoration: none;
317 }
318
319 mark {
320 border-radius: 2px;
321 padding-block-start: 0;
322 padding-block-end: 1px;
323 padding-inline-start: 3px;
324 padding-inline-end: 3px;
325 margin-block-start: 0;
326 margin-block-end: -1px;
327 margin-inline-start: -3px;
328 margin-inline-end: -3px;
329 background-color: var(--search-mark-bg);
330 transition: background-color 300ms linear;
331 cursor: pointer;
332 }
333
334 mark.fade-out {
335 background-color: rgba(0,0,0,0) !important;
336 cursor: auto;
337 }
338
339 .searchbar-outer {
340 margin-inline-start: auto;
341 margin-inline-end: auto;
342 max-width: var(--content-max-width);
343 }
344
345 #mdbook-searchbar-outer.searching #mdbook-searchbar {
346 padding-right: 30px;
347 }
348 #mdbook-searchbar-outer .spinner-wrapper {
349 display: none;
350 }
351 #mdbook-searchbar-outer.searching .spinner-wrapper {
352 display: block;
353 }
354
355 .search-wrapper {
356 position: relative;
357 }
358
359 .spinner-wrapper {
360 --spinner-margin: 2px;
361 position: absolute;
362 margin-block-start: calc(var(--searchbar-margin-block-start) + var(--spinner-margin));
363 right: var(--spinner-margin);
364 top: 0;
365 bottom: var(--spinner-margin);
366 padding: 6px;
367 background-color: var(--bg);
368 }
369
370 #fa-spin {
371 animation: rotating 2s linear infinite;
372 display: inline-block;
373 }
374
375 @keyframes rotating {
376 from {
377 transform: rotate(0deg);
378 }
379 to {
380 transform: rotate(360deg);
381 }
382 }
383
384 #mdbook-searchbar {
385 width: 100%;
386 margin-block-start: var(--searchbar-margin-block-start);
387 margin-block-end: 0;
388 margin-inline-start: auto;
389 margin-inline-end: auto;
390 padding: 10px 16px;
391 transition: box-shadow 300ms ease-in-out;
392 border: 1px solid var(--searchbar-border-color);
393 border-radius: 3px;
394 background-color: var(--searchbar-bg);
395 color: var(--searchbar-fg);
396 }
397 #mdbook-searchbar:focus,
398 #mdbook-searchbar.active {
399 box-shadow: 0 0 3px var(--searchbar-shadow-color);
400 }
401
402 .searchresults-header {
403 font-weight: bold;
404 font-size: 1em;
405 padding-block-start: 18px;
406 padding-block-end: 0;
407 padding-inline-start: 5px;
408 padding-inline-end: 0;
409 color: var(--searchresults-header-fg);
410 }
411
412 .searchresults-outer {
413 margin-inline-start: auto;
414 margin-inline-end: auto;
415 max-width: var(--content-max-width);
416 border-block-end: 1px dashed var(--searchresults-border-color);
417 }
418
419 ul#mdbook-searchresults {
420 list-style: none;
421 padding-inline-start: 20px;
422 }
423 ul#mdbook-searchresults li {
424 margin: 10px 0px;
425 padding: 2px;
426 border-radius: 2px;
427 }
428 ul#mdbook-searchresults li.focus {
429 background-color: var(--searchresults-li-bg);
430 }
431 ul#mdbook-searchresults span.teaser {
432 display: block;
433 clear: both;
434 margin-block-start: 5px;
435 margin-block-end: 0;
436 margin-inline-start: 20px;
437 margin-inline-end: 0;
438 font-size: 0.8em;
439 }
440 ul#mdbook-searchresults span.teaser em {
441 font-weight: bold;
442 font-style: normal;
443 }
444
445 /* Sidebar */
446
447 .sidebar {
448 position: fixed;
449 left: 0;
450 top: 0;
451 bottom: 0;
452 width: var(--sidebar-width);
453 font-size: 0.875em;
454 box-sizing: border-box;
455 -webkit-overflow-scrolling: touch;
456 overscroll-behavior-y: contain;
457 background-color: var(--sidebar-bg);
458 color: var(--sidebar-fg);
459 }
460 .sidebar-iframe-inner {
461 --padding: 10px;
462
463 background-color: var(--sidebar-bg);
464 padding: var(--padding);
465 margin: 0;
466 font-size: 1.4rem;
467 color: var(--sidebar-fg);
468 min-height: calc(100vh - var(--padding) * 2);
469 }
470 .sidebar-iframe-outer {
471 border: none;
472 height: 100%;
473 position: absolute;
474 top: 0;
475 bottom: 0;
476 left: 0;
477 right: 0;
478 }
479 [dir=rtl] .sidebar { left: unset; right: 0; }
480 .sidebar-resizing {
481 -moz-user-select: none;
482 -webkit-user-select: none;
483 -ms-user-select: none;
484 user-select: none;
485 }
486 html:not(.sidebar-resizing) .sidebar {
487 transition: transform 0.3s; /* Animation: slide away */
488 }
489 .sidebar code {
490 line-height: 2em;
491 }
492 .sidebar .sidebar-scrollbox {
493 overflow-y: auto;
494 position: absolute;
495 top: 0;
496 bottom: 0;
497 left: 0;
498 right: 0;
499 padding: 10px 10px;
500 }
501 .sidebar .sidebar-resize-handle {
502 position: absolute;
503 cursor: col-resize;
504 width: 0;
505 right: calc(var(--sidebar-resize-indicator-width) * -1);
506 top: 0;
507 bottom: 0;
508 display: flex;
509 align-items: center;
510 }
511
512 .sidebar-resize-handle .sidebar-resize-indicator {
513 width: 100%;
514 height: 16px;
515 color: var(--icons);
516 margin-inline-start: var(--sidebar-resize-indicator-space);
517 display: flex;
518 align-items: center;
519 justify-content: flex-start;
520 }
521 .sidebar-resize-handle .sidebar-resize-indicator::before {
522 content: "";
523 width: 2px;
524 height: 12px;
525 border-left: dotted 2px currentColor;
526 }
527 .sidebar-resize-handle .sidebar-resize-indicator::after {
528 content: "";
529 width: 2px;
530 height: 16px;
531 border-left: dotted 2px currentColor;
532 }
533
534 [dir=rtl] .sidebar .sidebar-resize-handle {
535 left: calc(var(--sidebar-resize-indicator-width) * -1);
536 right: unset;
537 }
538 .js .sidebar .sidebar-resize-handle {
539 cursor: col-resize;
540 width: calc(var(--sidebar-resize-indicator-width) - var(--sidebar-resize-indicator-space));
541 }
542
543 html:not(.js) .sidebar-resize-handle {
544 display: none;
545 }
546
547 /* sidebar-hidden */
548 #mdbook-sidebar-toggle-anchor:not(:checked) ~ .sidebar {
549 transform: translateX(calc(0px - var(--sidebar-width) - var(--sidebar-resize-indicator-width)));
550 }
551 [dir=rtl] #mdbook-sidebar-toggle-anchor:not(:checked) ~ .sidebar {
552 transform: translateX(calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width)));
553 }
554 .sidebar::-webkit-scrollbar {
555 background: var(--sidebar-bg);
556 }
557 .sidebar::-webkit-scrollbar-thumb {
558 background: var(--scrollbar);
559 }
560
561 /* sidebar-visible */
562 #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper {
563 transform: translateX(calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width)));
564 }
565 [dir=rtl] #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper {
566 transform: translateX(calc(0px - var(--sidebar-width) - var(--sidebar-resize-indicator-width)));
567 }
568 @media only screen and (min-width: 620px) {
569 #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper {
570 transform: none;
571 margin-inline-start: calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width));
572 }
573 [dir=rtl] #mdbook-sidebar-toggle-anchor:checked ~ .page-wrapper {
574 transform: none;
575 }
576 }
577
578 .chapter {
579 list-style: none outside none;
580 padding-inline-start: 0;
581 line-height: 2.2em;
582 }
583
584 .chapter li {
585 color: var(--sidebar-non-existant);
586 }
587
588 /* This is a span wrapping the chapter link and the fold chevron. */
589 .chapter-link-wrapper {
590 /* Used to position the chevron to the right, allowing the text to wrap before it. */
591 display: flex;
592 }
593
594 .chapter li a {
595 /* Remove underlines. */
596 text-decoration: none;
597 color: var(--sidebar-fg);
598 }
599
600 .chapter li a:hover {
601 color: var(--sidebar-active);
602 }
603
604 .chapter li a.active {
605 color: var(--sidebar-active);
606 }
607
608 /* This is the toggle chevron. */
609 .chapter-fold-toggle {
610 cursor: pointer;
611 /* Positions the chevron to the side. */
612 margin-inline-start: auto;
613 padding: 0 10px;
614 user-select: none;
615 opacity: 0.68;
616 }
617
618 .chapter-fold-toggle div {
619 transition: transform 0.5s;
620 }
621
622 /* collapse the section */
623 .chapter li:not(.expanded) > ol {
624 display: none;
625 }
626
627 .chapter li.chapter-item {
628 line-height: 1.5em;
629 margin-block-start: 0.6em;
630 }
631
632 .chapter li.header-item {
633 /* Make sure there is plenty of spacing between sections so they don't blend in
634 with each other. */
635 margin-block-end: 0.5em;
636 /* Avoid too much spacing between lines when section heading word wraps so that
637 it can be distinguished between successive headings. */
638 line-height: 1.5em;
639 }
640
641 /* When expanded, rotate the chevron to point down. */
642 .chapter li.expanded > span > .chapter-fold-toggle div {
643 transform: rotate(90deg);
644 }
645
646 .chapter a.current-header {
647 color: var(--sidebar-active);
648 }
649
650 .on-this-page {
651 margin-left: 22px;
652 border-inline-start: 4px solid var(--sidebar-header-border-color);
653 padding-left: 8px;
654 }
655
656 .on-this-page > ol {
657 padding-left: 0;
658 }
659
660 /* Horizontal line in chapter list. */
661 .spacer {
662 width: 100%;
663 height: 3px;
664 margin: 5px 0px;
665 }
666 .chapter .spacer {
667 background-color: var(--sidebar-spacer);
668 }
669
670 /* On touch devices, add more vertical spacing to make it easier to tap links. */
671 @media (-moz-touch-enabled: 1), (pointer: coarse) {
672 .chapter li a { padding: 5px 0; }
673 .spacer { margin: 10px 0; }
674 }
675
676 .section {
677 list-style: none outside none;
678 padding-inline-start: 20px;
679 line-height: 1.9em;
680 }
681
682 /* Theme Menu Popup */
683
684 .theme-popup {
685 position: absolute;
686 left: 10px;
687 top: var(--menu-bar-height);
688 z-index: 1000;
689 border-radius: 4px;
690 font-size: 0.7em;
691 color: var(--fg);
692 background: var(--theme-popup-bg);
693 border: 1px solid var(--theme-popup-border);
694 margin: 0;
695 padding: 0;
696 list-style: none;
697 display: none;
698 /* Don't let the children's background extend past the rounded corners. */
699 overflow: hidden;
700 }
701 [dir=rtl] .theme-popup { left: unset; right: 10px; }
702 .theme-popup .default {
703 color: var(--icons);
704 }
705 .theme-popup .theme {
706 width: 100%;
707 border: 0;
708 margin: 0;
709 padding: 2px 20px;
710 line-height: 25px;
711 white-space: nowrap;
712 text-align: start;
713 cursor: pointer;
714 color: inherit;
715 background: inherit;
716 font-size: inherit;
717 }
718 .theme-popup .theme:hover {
719 background-color: var(--theme-hover);
720 }
721
722 .theme-selected::before {
723 display: inline-block;
724 content: "✓";
725 margin-inline-start: -14px;
726 width: 14px;
727 }
728
729 /* The container for the help popup that covers the whole window. */
730 #mdbook-help-container {
731 /* Position and size for the whole window. */
732 position: fixed;
733 top: 0;
734 left: 0;
735 right: 0;
736 bottom: 0;
737 /* This uses flex layout (which is set in book.js), and centers the popup
738 in the window.*/
739 display: none;
740 align-items: center;
741 justify-content: center;
742 z-index: 1000;
743 /* Dim out the book while the popup is visible. */
744 background: var(--overlay-bg);
745 }
746
747 /* The popup help box. */
748 #mdbook-help-popup {
749 box-shadow: 0 4px 24px rgba(0,0,0,0.15);
750 min-width: 300px;
751 max-width: 500px;
752 width: 100%;
753 box-sizing: border-box;
754 display: flex;
755 flex-direction: column;
756 align-items: center;
757 background-color: var(--bg);
758 color: var(--fg);
759 border-width: 1px;
760 border-color: var(--theme-popup-border);
761 border-style: solid;
762 border-radius: 8px;
763 padding: 10px;
764 }
765
766 .mdbook-help-title {
767 text-align: center;
768 /* mdbook's margin for h2 is way too large. */
769 margin: 10px;
770 }