1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// The reader's choice of light, dark, or whatever the system is doing —
// shared by every page, inlined the way the stylesheet is.
//
// Two jobs. The first runs now, synchronously in the head, so the attribute
// is on <html> before the first paint: a reader who chose dark must never see
// a light frame on the way in. The second is `themeToggle`, which each page's
// own script calls to place the button — the pages have no shared header to
// put one in.
//
// `data-theme` is the whole mechanism: common.css keeps dark under
// prefers-color-scheme for anyone who has never touched the button, and reads
// the attribute as an override for anyone who has. "System" is the attribute
// being absent, which is why clearing it — not writing "system" — is how the
// cycle returns to following the OS.
;