| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,3 +28,20 @@ | |||
| 28 | 28 | color: #666; | |
| 29 | 29 | font-weight: lighter; | |
| 30 | 30 | } | |
| 31 | + | ||
| 32 | + .dark-mode .hljs-number, | ||
| 33 | + .dark-mode .hljs-string, | ||
| 34 | + .dark-mode .hljs-regexp { | ||
| 35 | + color: var(--green4); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + .dark-mode .hljs-keyword, | ||
| 39 | + .dark-mode .hljs-attribute { | ||
| 40 | + color: #66d9ef; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + .dark-mode .hljs-doctag .hljs-type, | ||
| 44 | + .dark-mode .hljs-doctag .hljs-variable, | ||
| 45 | + .dark-mode .hljs-comment { | ||
| 46 | + color: var(--gray7); | ||
| 47 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,55 @@ | |||
| 1 | + /*--------------------- CSS Variables ----------------------------*/ | ||
| 2 | + :root { | ||
| 3 | + --black: #000000; | ||
| 4 | + --black1: #090c15; | ||
| 5 | + --black2: #2c3437; | ||
| 6 | + --black3: #0d111d; | ||
| 7 | + --white: #ffffff; | ||
| 8 | + --white-smoke: #f2f2f2; | ||
| 9 | + --grey-smoke: #e9edf0; | ||
| 10 | + --red1: #d60027; | ||
| 11 | + --red2: #d50027; | ||
| 12 | + --red3: #ca5010; | ||
| 13 | + --green1: #43853d; | ||
| 14 | + --green2: #5a8147; | ||
| 15 | + --green3: #454545; | ||
| 16 | + --green4: #99cc7d; | ||
| 17 | + --green5: #84ba64; | ||
| 18 | + --gray1: #707070; | ||
| 19 | + --gray2: #b4b4b4; | ||
| 20 | + --gray3: #cccccc; | ||
| 21 | + --gray4: #040404; | ||
| 22 | + --gray5: #7a7a7a; | ||
| 23 | + --gray6: #333333; | ||
| 24 | + --gray7: #c1c1c1; | ||
| 25 | + --grey8: #ddd; | ||
| 26 | + | ||
| 27 | + --color-brand-primary: var(--gray6); | ||
| 28 | + --color-brand-secondary: var(--green1); | ||
| 29 | + --color-text-primary: var(--gray6); | ||
| 30 | + --color-text-secondary: var(--green2); | ||
| 31 | + --color-fill-app: var(--white); | ||
| 32 | + --color-text-nav: var(--gray3); | ||
| 33 | + --highlight-background-color: var(--white-smoke); | ||
| 34 | + --color-links: var(--green1); | ||
| 35 | + --color-fill-side-nav: var(--gray6); | ||
| 36 | + --api-stability-links-bg: rgba(255, 255, 255, .4) | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + .dark-mode { | ||
| 40 | + --color-links: var(--green5); | ||
| 41 | + --color-fill-app: var(--black1); | ||
| 42 | + --color-text-primary: var(--white); | ||
| 43 | + --color-fill-side-nav: var(--black3); | ||
| 44 | + --highlight-background-color: var(--black2); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + .dark-mode code, | ||
| 48 | + .dark-mode tt { | ||
| 49 | + color: var(--grey-smoke); | ||
| 50 | + background-color: var(--highlight-background-color); | ||
| 51 | + } | ||
| 52 | + | ||
| 1 | 53 | /*--------------------- Layout and Typography ----------------------------*/ | |
| 2 | 54 | html { | |
| 3 | 55 | font-size: 1rem; | |
@@ -16,8 +68,8 @@ body { | |||
| 16 | 68 | font-family: Lato, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif; | |
| 17 | 69 | margin: 0; | |
| 18 | 70 | padding: 0; | |
| 19 | - color: #333; | ||
| 20 | - background-color: #fff; | ||
| 71 | + color: var(--color-text-primary); | ||
| 72 | + background-color: var(--color-fill-app); | ||
| 21 | 73 | } | |
| 22 | 74 | ||
| 23 | 75 | h1, h1 code { font-size: 2.5rem; } | |
@@ -67,16 +119,16 @@ a.type { | |||
| 67 | 119 | a:link, | |
| 68 | 120 | a:active, | |
| 69 | 121 | a:visited { | |
| 70 | - color: #43853d; | ||
| 122 | + color: var(--color-links); | ||
| 71 | 123 | text-decoration: none; | |
| 72 | 124 | border-radius: 2px; | |
| 73 | 125 | padding: 1px 3px; | |
| 74 | 126 | } | |
| 75 | 127 | ||
| 76 | 128 | a:hover, | |
| 77 | 129 | a:focus { | |
| 78 | - color: #fff; | ||
| 79 | - background-color: #43853d; | ||
| 130 | + color: var(--white); | ||
| 131 | + background-color:var(--green1); | ||
| 80 | 132 | outline: none; | |
| 81 | 133 | } | |
| 82 | 134 | ||
@@ -109,7 +161,7 @@ em code { | |||
| 109 | 161 | ||
| 110 | 162 | #gtoc > ul > li { | |
| 111 | 163 | display: inline; | |
| 112 | - border-right: 1px #000 solid; | ||
| 164 | + border-right: 1px currentColor solid; | ||
| 113 | 165 | margin-right: .4rem; | |
| 114 | 166 | padding-right: .4rem; | |
| 115 | 167 | } | |
@@ -138,8 +190,8 @@ li.version-picker a span { | |||
| 138 | 190 | } | |
| 139 | 191 | ||
| 140 | 192 | ol.version-picker { | |
| 141 | - background-color: #fff; | ||
| 142 | - border: 1px solid #43853d; | ||
| 193 | + background-color: var(--color-fill-app); | ||
| 194 | + border: 1px solid var(--color-brand-secondary); | ||
| 143 | 195 | border-radius: 0 0 2px 2px; | |
| 144 | 196 | display: none; | |
| 145 | 197 | list-style: none; | |
@@ -175,14 +227,14 @@ ol.version-picker li:last-child a { | |||
| 175 | 227 | } | |
| 176 | 228 | ||
| 177 | 229 | .api_stability { | |
| 178 | - color: #fff !important; | ||
| 230 | + color: var(--white) !important; | ||
| 179 | 231 | margin: 0 0 1rem; | |
| 180 | 232 | padding: 1rem; | |
| 181 | 233 | line-height: 1.5; | |
| 182 | 234 | } | |
| 183 | 235 | ||
| 184 | 236 | .api_stability * { | |
| 185 | - color: #fff !important; | ||
| 237 | + color: var(--white) !important; | ||
| 186 | 238 | } | |
| 187 | 239 | ||
| 188 | 240 | .api_stability a { | |
@@ -192,23 +244,23 @@ ol.version-picker li:last-child a { | |||
| 192 | 244 | .api_stability a:hover, | |
| 193 | 245 | .api_stability a:active, | |
| 194 | 246 | .api_stability a:focus { | |
| 195 | - background-color: rgba(255, 255, 255, .4); | ||
| 247 | + background-color: var(--api-stability-links-bg); | ||
| 196 | 248 | } | |
| 197 | 249 | ||
| 198 | 250 | .api_stability a code { | |
| 199 | 251 | background-color: transparent; | |
| 200 | 252 | } | |
| 201 | 253 | ||
| 202 | 254 | .api_stability_0 { | |
| 203 | - background-color: #d60027; | ||
| 255 | + background-color: var(--red1); | ||
| 204 | 256 | } | |
| 205 | 257 | ||
| 206 | 258 | .api_stability_1 { | |
| 207 | - background-color: #ca5010; | ||
| 259 | + background-color: var(--red3); | ||
| 208 | 260 | } | |
| 209 | 261 | ||
| 210 | 262 | .api_stability_2 { | |
| 211 | - background-color: #5a8147; | ||
| 263 | + background-color: var(--green2); | ||
| 212 | 264 | } | |
| 213 | 265 | ||
| 214 | 266 | .api_metadata { | |
@@ -386,7 +438,7 @@ code { | |||
| 386 | 438 | pre { | |
| 387 | 439 | padding: 1rem; | |
| 388 | 440 | vertical-align: top; | |
| 389 | - background-color: #f2f2f2; | ||
| 441 | + background-color: var(--highlight-background-color); | ||
| 390 | 442 | margin: 1rem; | |
| 391 | 443 | overflow-x: auto; | |
| 392 | 444 | } | |
@@ -409,14 +461,14 @@ code.pre { | |||
| 409 | 461 | } | |
| 410 | 462 | ||
| 411 | 463 | #intro a { | |
| 412 | - color: #ddd; | ||
| 464 | + color: var(--grey8); | ||
| 413 | 465 | font-weight: 700; | |
| 414 | 466 | } | |
| 415 | 467 | ||
| 416 | 468 | hr { | |
| 417 | 469 | background-color: transparent; | |
| 418 | 470 | border: medium none; | |
| 419 | - border-bottom: 1px solid #7a7a7a; | ||
| 471 | + border-bottom: 1px solid var(--gray5); | ||
| 420 | 472 | margin: 0 0 1rem; | |
| 421 | 473 | } | |
| 422 | 474 | ||
@@ -442,8 +494,8 @@ hr { | |||
| 442 | 494 | } | |
| 443 | 495 | ||
| 444 | 496 | #toc .stability_0::after { | |
| 445 | - background-color: #d50027; | ||
| 446 | - color: #fff; | ||
| 497 | + background-color: var(--red2); | ||
| 498 | + color: var(--white); | ||
| 447 | 499 | content: "deprecated"; | |
| 448 | 500 | margin-left: .25rem; | |
| 449 | 501 | padding: 1px 3px; | |
@@ -488,7 +540,7 @@ a code { | |||
| 488 | 540 | ||
| 489 | 541 | #column2.interior { | |
| 490 | 542 | width: 234px; | |
| 491 | - background-color: #333; | ||
| 543 | + background-color: var(--color-fill-side-nav); | ||
| 492 | 544 | position: fixed; | |
| 493 | 545 | left: 0; | |
| 494 | 546 | top: 0; | |
@@ -500,7 +552,7 @@ a code { | |||
| 500 | 552 | #column2 ul { | |
| 501 | 553 | list-style: none; | |
| 502 | 554 | margin: .9rem 0 .5rem; | |
| 503 | - background-color: #333; | ||
| 555 | + background-color: var(--color-fill-side-nav); | ||
| 504 | 556 | } | |
| 505 | 557 | ||
| 506 | 558 | #column2 > :first-child { | |
@@ -532,23 +584,23 @@ a code { | |||
| 532 | 584 | } | |
| 533 | 585 | ||
| 534 | 586 | #column2 ul li a { | |
| 535 | - color: #ccc; | ||
| 587 | + color: var(--color-text-nav); | ||
| 536 | 588 | border-radius: 0; | |
| 537 | 589 | } | |
| 538 | 590 | ||
| 539 | 591 | #column2 ul li a.active, | |
| 540 | 592 | #column2 ul li a.active:hover, | |
| 541 | 593 | #column2 ul li a.active:focus { | |
| 542 | 594 | font-weight: 700; | |
| 543 | - color: #fff; | ||
| 595 | + color: var(--white); | ||
| 544 | 596 | background-color: transparent; | |
| 545 | 597 | } | |
| 546 | 598 | ||
| 547 | 599 | #intro a:hover, | |
| 548 | 600 | #intro a:focus, | |
| 549 | 601 | #column2 ul li a:hover, | |
| 550 | 602 | #column2 ul li a:focus { | |
| 551 | - color: #fff; | ||
| 603 | + color: var(--white); | ||
| 552 | 604 | background-color: transparent; | |
| 553 | 605 | } | |
| 554 | 606 | ||
@@ -563,7 +615,7 @@ span > .mark:visited { | |||
| 563 | 615 | span > .mark:hover, | |
| 564 | 616 | span > .mark:focus, | |
| 565 | 617 | span > .mark:active { | |
| 566 | - color: #43853d; | ||
| 618 | + color: var(--color-brand-secondary); | ||
| 567 | 619 | background-color: transparent; | |
| 568 | 620 | } | |
| 569 | 621 | ||
@@ -577,7 +629,7 @@ kbd { | |||
| 577 | 629 | border-radius: 3px; | |
| 578 | 630 | border: 1px solid #b4b4b4; | |
| 579 | 631 | box-shadow: 0 1px 1px rgba(0, 0, 0, .2); | |
| 580 | - color: #333; | ||
| 632 | + color: var(--color-text-primary); | ||
| 581 | 633 | display: inline-block; | |
| 582 | 634 | font-size: .85em; | |
| 583 | 635 | font-weight: 700; | |
@@ -649,6 +701,23 @@ kbd { | |||
| 649 | 701 | } | |
| 650 | 702 | } | |
| 651 | 703 | ||
| 704 | + .header-container { | ||
| 705 | + display: flex; | ||
| 706 | + align-items: center; | ||
| 707 | + margin: 1.5rem 0 1rem; | ||
| 708 | + justify-content: space-between; | ||
| 709 | + } | ||
| 710 | + | ||
| 711 | + .header-container h1 { | ||
| 712 | + margin: 0; | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + .theme-toggle-btn { | ||
| 716 | + border: none; | ||
| 717 | + background: transparent; | ||
| 718 | + outline: var(--brand3) dotted 2px; | ||
| 719 | + } | ||
| 720 | + | ||
| 652 | 721 | @media only screen and (max-width: 1024px) { | |
| 653 | 722 | #content { | |
| 654 | 723 | overflow: visible; | |
@@ -665,6 +734,28 @@ kbd { | |||
| 665 | 734 | } | |
| 666 | 735 | } | |
| 667 | 736 | ||
| 737 | + .icon { | ||
| 738 | + cursor: pointer; | ||
| 739 | + } | ||
| 740 | + | ||
| 741 | + .dark-icon { | ||
| 742 | + display: block; | ||
| 743 | + } | ||
| 744 | + | ||
| 745 | + .light-icon { | ||
| 746 | + fill: var(--white); | ||
| 747 | + display: none; | ||
| 748 | + } | ||
| 749 | + | ||
| 750 | + .dark-mode .dark-icon { | ||
| 751 | + display: none; | ||
| 752 | + } | ||
| 753 | + | ||
| 754 | + .dark-mode .light-icon { | ||
| 755 | + fill: var(--white); | ||
| 756 | + display: block; | ||
| 757 | + } | ||
| 758 | + | ||
| 668 | 759 | @media print { | |
| 669 | 760 | html { | |
| 670 | 761 | height: auto; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - <!doctype html> | ||
| 1 | + <!DOCTYPE html> | ||
| 2 | 2 | <html lang="en"> | |
| 3 | 3 | <head> | |
| 4 | 4 | <meta charset="utf-8"> | |
@@ -23,7 +23,20 @@ | |||
| 23 | 23 | ||
| 24 | 24 | <div id="column1" data-id="__ID__" class="interior"> | |
| 25 | 25 | <header> | |
| 26 | - <h1>Node.js __VERSION__ Documentation</h1> | ||
| 26 | + <div class="header-container"> | ||
| 27 | + <h1>Node.js __VERSION__ Documentation</h1> | ||
| 28 | + <button class="theme-toggle-btn" id="theme-toggle-btn" hidden> | ||
| 29 | + <svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24"> | ||
| 30 | + <path fill="none" d="M0 0h24v24H0z" /> | ||
| 31 | + <path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/> | ||
| 32 | + <path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/> | ||
| 33 | + </svg> | ||
| 34 | + <svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24"> | ||
| 35 | + <path d="M0 0h24v24H0z" fill="none" /> | ||
| 36 | + <path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/> | ||
| 37 | + </svg> | ||
| 38 | + </button> | ||
| 39 | + </div> | ||
| 27 | 40 | <div id="gtoc"> | |
| 28 | 41 | <ul> | |
| 29 | 42 | <li> | |
@@ -54,4 +67,40 @@ <h2>Table of Contents</h2> | |||
| 54 | 67 | </div> | |
| 55 | 68 | </div> | |
| 56 | 69 | </body> | |
| 70 | + <script> | ||
| 71 | + 'use strict'; | ||
| 72 | + { | ||
| 73 | + const kCustomPreference = 'customDarkTheme'; | ||
| 74 | + const userSettings = sessionStorage.getItem(kCustomPreference); | ||
| 75 | + const themeToggleButton = document.getElementById('theme-toggle-btn'); | ||
| 76 | + if (userSettings === null && window.matchMedia) { | ||
| 77 | + const mq = window.matchMedia('(prefers-color-scheme: dark)'); | ||
| 78 | + if ('onchange' in mq) { | ||
| 79 | + function mqChangeListener(e) { | ||
| 80 | + document.body.classList.toggle('dark-mode', e.matches); | ||
| 81 | + } | ||
| 82 | + mq.addEventListener('change', mqChangeListener); | ||
| 83 | + if (themeToggleButton) { | ||
| 84 | + themeToggleButton.addEventListener('click', function() { | ||
| 85 | + mq.removeEventListener('change', mqChangeListener); | ||
| 86 | + }, { once: true }); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + if (mq.matches) { | ||
| 90 | + document.body.classList.add('dark-mode'); | ||
| 91 | + } | ||
| 92 | + } else if (userSettings === 'true') { | ||
| 93 | + document.body.classList.add('dark-mode'); | ||
| 94 | + } | ||
| 95 | + if (themeToggleButton) { | ||
| 96 | + themeToggleButton.hidden = false; | ||
| 97 | + themeToggleButton.addEventListener('click', function() { | ||
| 98 | + sessionStorage.setItem( | ||
| 99 | + kCustomPreference, | ||
| 100 | + document.body.classList.toggle('dark-mode') | ||
| 101 | + ); | ||
| 102 | + }); | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + </script> | ||
| 57 | 106 | </html> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments