|
3 | 3 | Generated into each lecture by scripts/sync-core-scss.py. DO NOT EDIT the |
4 | 4 | copy inside a lecture repo; edit this file and re-run the script. |
5 | 5 |
|
6 | | - Theme order in every lecture: |
| 6 | + Theme order in every lecture (wired by scripts/wire-dark-mode.py): |
7 | 7 |
|
8 | 8 | theme: |
9 | | - - default |
10 | | - - fonts.scss self-hosted @font-face, no CDN |
11 | | - - _core.scss this file |
12 | | - - styles.scss lecture-local rules only |
13 | | - - brand _brand.yml |
| 9 | + light: [default, styles.scss, brand] |
| 10 | + dark: [default, _dark.scss, styles.scss, brand] |
| 11 | +
|
| 12 | + styles.scss is this file (it @imports _fonts.scss and _paper-and-ink.scss) |
| 13 | + followed by the lecture's LOCAL fragment. _dark.scss is the dark layer and |
| 14 | + sits in the dark list only. |
14 | 15 |
|
15 | 16 | Two things about that order, both verified against a real render: |
16 | 17 |
|
17 | 18 | 1. Quarto emits `scss:defaults` in REVERSE theme order. So `brand` is |
18 | | - declared first (which is why `$brand-*` resolves at all), and a lecture's |
19 | | - `styles.scss` is declared BEFORE this file — meaning a plain assignment |
20 | | - there pre-empts any `!default` below. That is how Study-Business-Basics |
21 | | - remaps the palette. |
| 19 | + declared first (which is why `$brand-*` resolves at all), and |
| 20 | + `_dark.scss` after this file, so its plain assignments replace the light |
| 21 | + values in the dark bundle. A plain assignment in a lecture's LOCAL |
| 22 | + fragment pre-empts any `!default` below: that is how |
| 23 | + Study-Business-Basics remaps the palette. |
22 | 24 | 2. `scss:rules` are emitted in FORWARD order, so a lecture's local rules |
23 | 25 | come after these and win on a tie. |
24 | 26 |
|
25 | 27 | ── Why the colours below are literal hex, not `$brand-*` ────────────────── |
26 | | - Only four palette tokens exist in ALL fifteen lectures: `codeline`, |
| 28 | + Only four palette tokens exist in ALL sixteen lectures: `codeline`, |
27 | 29 | `darker`, `greyer`, `lighter`. Study-Business-Basics has no `oneDark` / |
28 | 30 | `twoDark` / `threeDark` at all — its palette is `sand` / `teal` / |
29 | 31 | `dangerColor`, with different hex values. Referencing `$brand-twoDark` here |
@@ -662,8 +664,8 @@ html.print-pdf .reveal .r-stack table { |
662 | 664 | background: |
663 | 665 | linear-gradient(to right, var(--bs-body-bg) 40%, transparent) left center / 1.5rem 100% no-repeat local, |
664 | 666 | linear-gradient(to left, var(--bs-body-bg) 40%, transparent) right center / 1.5rem 100% no-repeat local, |
665 | | - radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.15), transparent) left 1px center / 0.45rem 100% no-repeat scroll, |
666 | | - radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.15), transparent) right 1px center / 0.45rem 100% no-repeat scroll; |
| 667 | + radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--bs-body-color) 25%, transparent), transparent) left 1px center / 0.45rem 100% no-repeat scroll, |
| 668 | + radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--bs-body-color) 25%, transparent), transparent) right 1px center / 0.45rem 100% no-repeat scroll; |
667 | 669 | } |
668 | 670 | :is(h1, h2, h3, h4) { |
669 | 671 | -webkit-hyphens: auto; |
@@ -737,24 +739,39 @@ blockquote.blockquote { |
737 | 739 | color: $lec-code-inline; |
738 | 740 | } |
739 | 741 |
|
740 | | -// Inline code in a heading takes the heading's colour. Quarto sets h3 to 90 % |
741 | | -// opacity, which pulled teal inline code in a heading under 4.5:1 on its chip |
742 | | -// (Introduction-to-Python's cheatsheet and FAQ: 4.23:1). |
743 | | -:is(h1, h2, h3, h4, h5, h6) > code:not(.sourceCode) { |
| 742 | +// Inline code in a heading, a footnote or a callout title takes the text's |
| 743 | +// colour. Quarto sets h3 and the footnote list to 90 % opacity and the callout |
| 744 | +// header to 75 %, which pulled teal inline code under 4.5:1 on its chip |
| 745 | +// (Introduction-to-Python's cheatsheet and FAQ: 4.23:1; Materiallogistik's |
| 746 | +// footnotes: 3.81:1; Grundlagen-OR's callout titles: 2.89:1). |
| 747 | +:is(h1, h2, h3, h4, h5, h6) > code:not(.sourceCode), |
| 748 | +.footnotes code:not(.sourceCode), |
| 749 | +.callout-header code:not(.sourceCode) { |
744 | 750 | color: inherit; |
745 | 751 | } |
| 752 | +// A link or a coloured text class in a callout title keeps full strength: at |
| 753 | +// the header's 75 % the link red fell to 4.23:1 (Study-Business-Basics' index |
| 754 | +// cards). `div.` ties with Quarto's `.callout.callout-style-simple > |
| 755 | +// div.callout-header { opacity: 75% }`, and this rule comes later in the bundle. |
| 756 | +div.callout-header:has(.callout-title-container :is(a, .highlight, .errors, .task, .question)) { |
| 757 | + opacity: 1; |
| 758 | +} |
746 | 759 |
|
747 | 760 | // ANSI output, see $lec-ansi. Scoped to .ansi-escaped-output so it outranks |
748 | 761 | // Quarto's own notebook colours whatever order the layers come in. |
749 | 762 | @each $hue, $pair in $lec-ansi { |
750 | 763 | .ansi-escaped-output .ansi-#{$hue}-fg { color: nth($pair, 1); } |
751 | 764 | .ansi-escaped-output :is(.ansi-bright-#{$hue}-fg, .ansi-#{$hue}-intense-#{$hue}) { color: nth($pair, 2); } |
752 | | - .ansi-escaped-output .ansi-#{$hue}-bg { background-color: nth($pair, 1); color: $lec-ansi-on-colour; } |
753 | | - .ansi-escaped-output .ansi-bright-#{$hue}-bg { background-color: nth($pair, 2); color: $lec-ansi-on-colour; } |
754 | 765 | } |
755 | 766 | .ansi-escaped-output .ansi-bright-black-fg { |
756 | 767 | color: $lec-ansi-grey; |
757 | 768 | } |
| 769 | +// Backgrounds after every foreground, so a span with both classes takes the |
| 770 | +// on-colour text whatever its hues. |
| 771 | +@each $hue, $pair in $lec-ansi { |
| 772 | + .ansi-escaped-output .ansi-#{$hue}-bg { background-color: nth($pair, 1); color: $lec-ansi-on-colour; } |
| 773 | + .ansi-escaped-output .ansi-bright-#{$hue}-bg { background-color: nth($pair, 2); color: $lec-ansi-on-colour; } |
| 774 | +} |
758 | 775 | // IPython writes 256-colour codes as inline styles. The one in use (colour |
759 | 776 | // 28, a green; 3.9:1 on the dark ground) follows the palette's green. |
760 | 777 | .ansi-escaped-output span[style*="rgb(0,135,0)"]:not([class*="-bg"]) { |
@@ -790,9 +807,38 @@ pre.numberSource code > span > a:first-child::before { |
790 | 807 | } |
791 | 808 | body.quarto-light .quarto-color-scheme-toggle .bi::before { |
792 | 809 | content: "\f497"; // bi-moon |
| 810 | + content: "\f497" / ""; // no alt text: the link's title stays its name |
793 | 811 | } |
794 | 812 | body.quarto-dark .quarto-color-scheme-toggle .bi::before { |
795 | 813 | content: "\f5a2"; // bi-sun |
| 814 | + content: "\f5a2" / ""; |
| 815 | +} |
| 816 | + |
| 817 | +// Plots on a dark page: the courses' plot helpers draw on a transparent |
| 818 | +// background in the brand's dark text, which vanishes on the dark ground. Every |
| 819 | +// image a code cell produces (also in a `layout` panel, which has no |
| 820 | +// .cell-output-display) sits on the light page colour as a card, as opaque |
| 821 | +// figures already do. A hand-made transparent diagram opts in with |
| 822 | +// `{.light-card}`. Later, maybe: a dark rendering per plot (Quarto's |
| 823 | +// `renderings: [light, dark]`). |
| 824 | +body.quarto-dark :is(div.cell img, img.light-card) { |
| 825 | + background-color: $pi-light-ground; |
| 826 | + border-radius: 6px; |
| 827 | +} |
| 828 | + |
| 829 | +// QR codes (transparent, dark modules: `assets/qr/`, `images/*-qr.svg`) turn |
| 830 | +// white on a dark page; scanners read them inverted. Keep them out of the card |
| 831 | +// above (a code cell, `.light-card`): white on it would vanish. Decks stay |
| 832 | +// light and keep the dark modules. |
| 833 | +body.quarto-dark img:is([src*="/qr/"], [src*="-qr."]) { |
| 834 | + filter: brightness(0) invert(1); |
| 835 | +} |
| 836 | + |
| 837 | +// Search hits on a dark page sit on a dark fill ($mark-bg in _dark.scss), but |
| 838 | +// the browser paints <mark> text black (2.0:1 there). They take the text's own |
| 839 | +// colour: body text 7.6:1, links 5.6:1. Light mode keeps the black. |
| 840 | +body.quarto-dark mark { |
| 841 | + color: inherit; |
796 | 842 | } |
797 | 843 |
|
798 | 844 | // Footer, slide number, blockquotes and asides on a light slide: everything |
@@ -847,10 +893,3 @@ body.quarto-dark .quarto-color-scheme-toggle .bi::before { |
847 | 893 | _core.scss by scripts/sync-core-scss.py. Edit it there, not here. |
848 | 894 | Everything BELOW is yours and is preserved across syncs. |
849 | 895 | ───────────────────────────────────────────────────────────────────────── */ |
850 | | - |
851 | | -// Exercise QR codes (lectures/assets/qr, transparent PNGs from |
852 | | -// helpers/make_qr.py): white squares on the dark page in dark mode. Decks |
853 | | -// stay light and keep the slate squares. |
854 | | -body.quarto-dark img[src*="assets/qr/"] { |
855 | | - filter: brightness(0) invert(1); |
856 | | -} |
|
0 commit comments