Skip to content

Commit cdf216c

Browse files
committed
fix: make the theme toggle visibly change the page
The header, the hero and the footer were Ink in both schemes, so at the top of the page the sun and moon changed nothing a reader could see, and the three-state toggle added a "follow system" step that, on a light system, changed nothing at all. The light scheme now has a white header and a light hero, and the toggle has two states; the first visit still follows the system through the palette's media queries.
1 parent 4cac48a commit cdf216c

3 files changed

Lines changed: 81 additions & 4 deletions

File tree

‎docs/assets/extra.css‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,27 @@
4343

4444
[data-md-color-scheme="default"] {
4545
--md-typeset-a-color: var(--cc-link);
46+
/* A light header in the light scheme, Ink in the dark one, so the header
47+
answers the theme toggle like the rest of the page. */
48+
--md-primary-fg-color: #ffffff;
49+
--md-primary-fg-color--light: #f4f6f7;
50+
--md-primary-fg-color--dark: #eef2f4;
51+
--md-primary-bg-color: var(--cc-ink);
52+
--md-primary-bg-color--light: #4f6270;
53+
}
54+
55+
[data-md-color-scheme="default"] .md-header {
56+
box-shadow: inset 0 -1px 0 #dce3e8;
57+
}
58+
59+
/* The theme's search field is a translucent black meant for a coloured
60+
header; on a white one it needs a solid tint instead. */
61+
[data-md-color-scheme="default"] .md-search__form {
62+
background-color: #eef2f4;
63+
}
64+
65+
[data-md-color-scheme="default"] .md-search__form:hover {
66+
background-color: #e4e9ed;
4667
}
4768

4869
/* A primary button is Signal Blue with Ink text: white on this blue is 3.1:1,

‎docs/stylesheets/landing.css‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,3 +2477,59 @@
24772477
[data-md-color-scheme="slate"] .md-typeset .cc-group--ink {
24782478
border-color: #22404f;
24792479
}
2480+
2481+
/* --------------------------------------------------- hero, light scheme -- */
2482+
2483+
/* In the light scheme the hero is light too, so the theme toggle changes what
2484+
is on screen at the top of the page. The terminal and the install command
2485+
stay dark: they stand for a terminal, which is dark in either theme. The
2486+
Action band and the closing band stay Ink in both schemes as a stage for
2487+
the demo. */
2488+
[data-md-color-scheme="default"] .md-typeset .cc-hero {
2489+
background: #ffffff;
2490+
color: var(--cc-text);
2491+
box-shadow: inset 0 -1px 0 var(--cc-line);
2492+
}
2493+
2494+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-display {
2495+
color: var(--cc-text);
2496+
}
2497+
2498+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-accent {
2499+
/* Signal Blue is 3.1:1 on white, enough for display type (3:1 from 24px). */
2500+
color: var(--cc-blue);
2501+
}
2502+
2503+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-lede {
2504+
color: var(--cc-muted);
2505+
}
2506+
2507+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-lede code {
2508+
color: var(--cc-text);
2509+
}
2510+
2511+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-pill {
2512+
border-color: #b9dcec;
2513+
background: var(--cc-tint);
2514+
color: #135a74;
2515+
}
2516+
2517+
[data-md-color-scheme="default"] .md-typeset .cc-hero ul.cc-facts {
2518+
border-top-color: var(--cc-line);
2519+
color: var(--cc-muted);
2520+
}
2521+
2522+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-install {
2523+
border-color: var(--cc-ink);
2524+
background: var(--cc-ink);
2525+
}
2526+
2527+
[data-md-color-scheme="default"] .md-typeset .cc-hero .cc-term {
2528+
box-shadow: 0 24px 60px rgba(11, 22, 32, 0.22);
2529+
}
2530+
2531+
/* The history-line motif's nodes are filled with the ground colour so the
2532+
lines pass behind them; on the light hero that ground is white. */
2533+
[data-md-color-scheme="default"] .md-typeset .cc-hero__graph circle {
2534+
fill: #ffffff;
2535+
}

‎mkdocs.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ theme:
4141
font:
4242
text: Instrument Sans
4343
code: JetBrains Mono
44+
# Two states, not three. The first visit still follows the system through
45+
# the media queries; after that every click visibly changes the page. A
46+
# third "follow system" state made one click in three do nothing a reader
47+
# could see, which read as a broken toggle.
4448
palette:
45-
- media: "(prefers-color-scheme)"
46-
toggle:
47-
icon: material/brightness-auto
48-
name: Follow system theme
4949
- media: "(prefers-color-scheme: light)"
5050
scheme: default
5151
primary: custom

0 commit comments

Comments
 (0)