Skip to content

Commit 19dfd99

Browse files
committed
fix(docs): make the secondary hero button visible in dark mode
An outlined Material button takes its text and border from the primary colour, which is the header's dark brown. On the dark page that left "Get started" at 1.71:1 against its own background, drawn but not visible, and its hover state at 2.13:1, since Material writes white on the light green accent. Both now use a foreground chosen for that background: 12.44 and 7.59. Fixing it turned up why the light scheme never looked brown. The brand primary and accent were declared on :root, where Material's own scheme block outranks them, so light mode kept the stock indigo for links and buttons underneath a brown and green header. Declared on the scheme itself they take, and both now read 7.46 against the page. Dark-mode links keep Material's blue. It is legible at 5.27 and is what a link is expected to look like, so it is left alone rather than made warm for consistency's sake.
1 parent a6a0dda commit 19dfd99

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

docs/stylesheets/extra.css

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
--admincraft-dirt: #805539;
33
--admincraft-grass: #5f7f3b;
44
--admincraft-ink: #252018;
5-
--md-primary-fg-color: #6f4933;
6-
--md-primary-fg-color--light: #94684a;
7-
--md-primary-fg-color--dark: #4b3022;
8-
--md-accent-fg-color: #658746;
5+
--admincraft-sand: #e3d3bd;
96
}
107

118
/* Tint Material's own schemes rather than declaring new ones.
@@ -19,6 +16,13 @@
1916
--md-default-bg-color: #fbf9f4;
2017
--md-default-fg-color: var(--admincraft-ink);
2118
--md-code-bg-color: #eee9dd;
19+
/* These sat on :root, where Material's own scheme block outranked them, so
20+
* light mode kept the stock indigo for links and buttons under a brown and
21+
* green header. They have to be set on the scheme itself to take. */
22+
--md-primary-fg-color: #6f4933;
23+
--md-primary-fg-color--light: #94684a;
24+
--md-primary-fg-color--dark: #4b3022;
25+
--md-accent-fg-color: #658746;
2226
}
2327

2428
[data-md-color-scheme="slate"] {
@@ -93,6 +97,22 @@
9397
border-color: var(--admincraft-grass) !important;
9498
}
9599

100+
/* An outlined button takes its text and border from --md-primary-fg-color,
101+
* which is the header colour. That is a dark brown here, so on the dark page
102+
* the secondary button sat at 1.7:1 against its own background: drawn, but not
103+
* visible. Material's hover then paints it with the accent and writes on it in
104+
* --md-accent-bg-color, which slate leaves as white, giving 2.1:1 on light
105+
* green. Both need a foreground chosen for this background rather than
106+
* inherited from the header. */
107+
[data-md-color-scheme="slate"] .md-button {
108+
color: var(--admincraft-sand);
109+
}
110+
111+
[data-md-color-scheme="slate"] .md-button:focus,
112+
[data-md-color-scheme="slate"] .md-button:hover {
113+
color: var(--admincraft-ink);
114+
}
115+
96116
@media (max-width: 44.9844em) {
97117
.admincraft-hero {
98118
padding: 1.5rem 1rem;

0 commit comments

Comments
 (0)