Files
ProcessControl/_book/de/site_libs/quarto-contrib/calc-notes-1.0.0/theme.css
T

130 lines
5.6 KiB
CSS

/* theme.css — one palette for every part of the notes extension, in light
mode, in night mode and in high contrast.
Night mode keys off Quarto's own `body.quarto-dark`, which the light/dark
toggle sets — never off `prefers-color-scheme`, so a book configured
light-only stays light for a reader whose system is dark.
A book opts in with, in _quarto.yml:
format:
html:
theme:
light: [cosmo]
dark: [darkly]
High contrast is a separate sheet, high-contrast.css, after GitHub's two
high-contrast VS Code themes. It keys off `hc` on <html>, which
calc-notes.lua sets from `high-contrast: true` in the metadata and for a
reader whose system asks for `prefers-contrast: more`.
Loaded with calc-notes.css, so every page of every book has these tokens. */
:root {
--calc-ink: #1a1a1a; /* figure text, strong strokes */
--calc-muted: #57606a; /* captions, readouts, button text */
--calc-line: #444444; /* axes and rules */
--calc-grid: #cccccc; /* lattice dots, faint grid */
--calc-accent-a: #1F6FB4; /* lineA of the tikz preamble */
--calc-accent-b: #D1541F; /* lineB */
--calc-accent-c: #2E8B57; /* lineC */
--calc-danger: #B91C1C; /* an error state, e.g. a failed code run */
--calc-surface: var(--bs-body-bg, #ffffff);
--calc-faint: #e7e9ec; /* hairlines between rows */
--calc-shadow: rgba(0, 0, 0, 0.15); /* floats above the page */
--calc-domface: #DCE7F2; /* the domino figure's front face */
--calc-domtop: #B8CFE4; /* its top face */
/* --calc-notecolor-src and --calc-furthercolor-src come from the document
metadata (calc-notes.lua / further.lua) and are the book's own colours;
--calc-notecolor and --calc-furthercolor are what everything draws with,
and equal the source here. The dark block lifts them. */
}
body.quarto-dark {
--calc-ink: #e6e9ed;
--calc-muted: #9aa4b2;
--calc-line: #b6bec7;
--calc-grid: #4b535d;
--calc-accent-a: #6fb0ea;
--calc-accent-b: #f0956a;
--calc-accent-c: #64c49a;
--calc-danger: #f08a8a;
--calc-faint: #3a4049;
--calc-shadow: rgba(0, 0, 0, 0.55);
--calc-domface: #2b3b4d;
--calc-domtop: #365070;
/* The book's own accent is kept, not replaced: its print value is too dim
on a dark ground, so it is lifted to a light tone at the same hue rather
than swapped for a generic amber. A book that wants a specific night
value sets `notecolor-dark:` / `furthercolor-dark:` in its metadata.
On a browser without relative colour syntax the lift is dropped and the
book's own colour is used unchanged. */
--calc-notecolor:
var(--calc-notecolor-dark,
oklch(from var(--calc-notecolor-src, #B45309) 0.78 c h));
--calc-furthercolor:
var(--calc-furthercolor-dark,
oklch(from var(--calc-furthercolor-src, #6B3FA0) 0.80 c h));
}
/* --- generated line art -------------------------------------------------
The tikz figures are black-and-colour line drawings on transparent white.
Inverting them keeps the drawing readable and, with the hue rotation,
keeps blue blue and orange orange. Photographs live under img/ and are
left alone; an svg that is a photograph, or that carries its own dark
palette, opts out with class="no-invert". */
body.quarto-dark main img[src$=".svg"]:not(.no-invert) {
filter: invert(1) hue-rotate(180deg);
}
/* --- higher contrast ---------------------------------------------------
The high-contrast pair lives in high-contrast.css, which is loaded with
this file and keys off `hc` on <html>. */
/* --- Quarto's search box -------------------------------------------------
The search widget keeps its own white surface whatever the bootswatch
theme says, so on a dark page it is a white slab with dark text. It is
given the page's own surface here rather than in each book. */
body.quarto-dark :is(.aa-Form, .aa-InputWrapper, .aa-Panel, .aa-Item,
.aa-DetachedContainer, .aa-DetachedFormContainer) {
background-color: var(--calc-surface, #222);
color: var(--calc-ink, #e6e9ed);
border-color: var(--calc-faint, #3a4049);
}
/* The ink inside the form is a separate problem from its surface: Quarto's
dark bundle sets the input, its placeholder, the clear button and the
magnifier to rgb(45,45,45) through a four-class selector, so a short one
loses the cascade and the typed text stays unreadable. The shape below
matches Quarto's own, which is the only way to win without !important. */
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
.aa-Form .aa-InputWrapper .aa-Input,
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
.aa-Form .aa-InputWrapperSuffix .aa-ClearButton,
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
.aa-Form .aa-InputWrapperPrefix :is(.aa-Label, .aa-LoadingIndicator) svg {
color: var(--calc-ink, #e6e9ed);
}
body.quarto-dark :is(.aa-Autocomplete, .aa-DetachedFormContainer)
.aa-Form .aa-InputWrapper .aa-Input::placeholder {
color: var(--calc-muted, #9aa4b2);
}
/* --- the high-contrast switch -------------------------------------------
Built by calc-notes.js next to Quarto's light/dark toggle, and styled to
sit with it rather than stand out. */
.notes-contrast-toggle {
background: none;
border: 0;
color: inherit;
line-height: 1;
cursor: pointer;
opacity: 0.85;
}
.notes-contrast-toggle:hover { opacity: 1; }
.notes-contrast-toggle[aria-pressed="true"] {
opacity: 1;
color: var(--calc-accent-a, #1F6FB4);
}
.notes-contrast-toggle:focus-visible {
outline: 2px solid var(--calc-accent-a, #1F6FB4);
outline-offset: 2px;
}