Repository navigation
Expand file tree
/
Copy pathcustom.css
More file actions
442 lines (401 loc) · 16.6 KB
/
Copy pathcustom.css
File metadata and controls
442 lines (401 loc) · 16.6 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
/**
* The site's theme: colour tokens for each theme, the Infima variables they feed, and the fonts. The
* palette keeps the CGP logo's red, #8f1f1d, and builds the rest around it: a tint scale of the same
* hue, warm neutrals, and admonition and status colours made for it. The code colours live in
* src/prism/themes.ts. In the dark theme the logo's red reaches only about 2:1 against the
* background, so a lighter tint of the same hue carries links and other text, and `--cgp-red` stays
* for filled elements with white text.
*
* Page styles use these tokens rather than hex colours. After changing a colour, run
* `python3 scripts/theme/contrast.py`, which checks every pair against WCAG AA. The knowledge base's
* website section records the palette and its reasons.
*/
/* The fonts: Inter for body text and headings, and JetBrains Mono for code, self-hosted under
static/fonts/. Their @font-face rules are a style tag in docusaurus.config.ts, because a url() here
would be copied to a hashed name that the preload cannot match. Each face has a fallback sized to
its metrics, so text does not shift when the font arrives. The site ships no italic code face, so
the code themes set comments upright. */
/* Inter's average width is 104.93% of Arial's, and its ascent and descent are 0.969 and 0.241 em,
so the overrides divide those by the size adjustment. */
@font-face {
font-family: 'Inter Fallback';
src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('Helvetica');
font-weight: 400 500;
size-adjust: 104.93%;
ascent-override: 92.32%;
descent-override: 22.99%;
line-gap-override: 0%;
}
/* The bold fallback names a bold face, so the browser does not embolden the regular one. */
@font-face {
font-family: 'Inter Fallback';
src: local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold'), local('Helvetica Bold');
font-weight: 600 700;
size-adjust: 104.93%;
ascent-override: 92.32%;
descent-override: 22.99%;
line-gap-override: 0%;
}
@font-face {
font-family: 'JetBrains Mono Fallback';
src: local('Courier New'), local('Liberation Mono');
size-adjust: 100%;
ascent-override: 102%;
descent-override: 30%;
line-gap-override: 0%;
}
/* The light theme. `html[data-theme=...]` matches the specificity of Infima's own dark-theme rules. */
:root,
html[data-theme='light'] {
/* The brand red and its tint scale. */
--cgp-red: #8f1f1d;
--cgp-red-50: #fcf1ef;
--cgp-red-100: #f8e1dd;
--cgp-red-200: #f0c2bb;
--cgp-red-300: #e59a90;
--cgp-red-400: #d06b61;
--cgp-red-500: #b23a33;
--cgp-red-700: #741816;
--cgp-red-800: #5a1311;
--cgp-red-900: #3d0d0c;
/* Warm neutrals. Infima's own grey scale is cool, so it takes the same warm values. */
--ifm-color-gray-100: #f5efea;
--ifm-color-gray-200: #ebe2dc;
--ifm-color-gray-300: #ddd1ca;
--ifm-color-gray-400: #c4b6ae;
--ifm-color-gray-500: #a39189;
--ifm-color-gray-600: #7d6b64;
--ifm-color-gray-700: #5e504c;
--ifm-color-gray-800: #45393a;
--ifm-color-gray-900: #2b2221;
--cgp-bg: #fdfaf7;
--cgp-surface: #f7f0ea;
--cgp-surface-raised: #ffffff;
--cgp-border: #e3d5cb;
--cgp-text: #261d1b;
--cgp-text-muted: #66574f;
--cgp-heading: #1d1514;
/* Roles. */
--cgp-link: var(--cgp-red);
--cgp-link-hover: var(--cgp-red-700);
--cgp-focus: var(--cgp-red-500);
--cgp-code-bg: #f4ece5;
--cgp-inline-code-bg: #f1e6de;
--cgp-highlight-line: rgba(214, 150, 40, 0.18);
/* The front page's diff lines: a tint for the line Rust rejects and the lines CGP adds, and a
stronger colour for each one's gutter mark and verdict badge. */
--cgp-diff-removed: rgba(196, 55, 43, 0.1);
--cgp-diff-added: rgba(40, 150, 70, 0.16);
--cgp-diff-removed-mark: var(--ifm-color-danger);
--cgp-diff-added-mark: #2f7a40;
--cgp-selection: rgba(178, 58, 51, 0.18);
--cgp-image-frame: #ffffff;
--cgp-hero-art-bg: #fdefe1;
--cgp-announce-bg: #fbf1ed;
--cgp-announce-text: #4a2f2b;
--cgp-footer-bg: #4a1110;
--cgp-footer-text: #f7efec;
--cgp-footer-title: #ffffff;
--cgp-footer-link: #fdf4f1;
--cgp-on-red: #ffffff;
/* Infima: the primary scale. */
--ifm-color-primary: var(--cgp-red);
--ifm-color-primary-dark: #811c1a;
--ifm-color-primary-darker: #7a1a19;
--ifm-color-primary-darkest: #641614;
--ifm-color-primary-light: #9d2220;
--ifm-color-primary-lighter: #a42422;
--ifm-color-primary-lightest: #b72826;
/* Infima: the warm grey scale that borders, hovers, and secondary text use. */
--ifm-color-emphasis-0: #ffffff;
--ifm-color-emphasis-100: #f5efea;
--ifm-color-emphasis-200: #ebe2dc;
--ifm-color-emphasis-300: #ddd1ca;
--ifm-color-emphasis-400: #c4b6ae;
--ifm-color-emphasis-500: #a39189;
--ifm-color-emphasis-600: #7d6b64;
--ifm-color-emphasis-700: #5e504c;
--ifm-color-emphasis-800: #45393a;
--ifm-color-emphasis-900: #2b2221;
--ifm-color-emphasis-1000: #120d0c;
/* Infima: surfaces and text. Infima sets the two content colours to literal greys, which the table of
contents and other secondary text read, so they point at the tokens too. */
--ifm-color-content: var(--cgp-text);
--ifm-color-content-secondary: var(--cgp-text-muted);
--ifm-color-primary-contrast-background: var(--cgp-red-50);
--ifm-color-primary-contrast-foreground: var(--cgp-red-800);
--ifm-background-color: var(--cgp-bg);
--ifm-background-surface-color: var(--cgp-surface);
--ifm-font-color-base: var(--cgp-text);
--ifm-font-color-secondary: var(--cgp-text-muted);
--ifm-heading-color: var(--cgp-heading);
--ifm-link-color: var(--cgp-link);
--ifm-link-hover-color: var(--cgp-link-hover);
--ifm-navbar-background-color: var(--cgp-bg);
--ifm-navbar-link-color: var(--cgp-text);
--ifm-navbar-link-hover-color: var(--cgp-link);
--ifm-menu-color: var(--cgp-text-muted);
--ifm-menu-color-active: var(--cgp-red);
--ifm-menu-color-background-active: var(--cgp-red-50);
--ifm-menu-color-background-hover: var(--ifm-color-emphasis-100);
--ifm-toc-border-color: var(--cgp-border);
--ifm-hr-background-color: var(--cgp-border);
--ifm-table-border-color: var(--cgp-border);
--ifm-table-stripe-background: rgba(143, 31, 29, 0.03);
--ifm-table-head-background: var(--cgp-surface);
--ifm-code-background: var(--cgp-inline-code-bg);
--ifm-pre-background: var(--cgp-code-bg);
--ifm-card-background-color: var(--cgp-surface-raised);
--ifm-dropdown-background-color: var(--cgp-surface-raised);
--ifm-breadcrumb-item-background-active: var(--cgp-red-50);
--ifm-code-font-size: 90%;
--ifm-font-family-base: 'Inter', 'Inter Fallback', system-ui, -apple-system, 'Segoe UI', Roboto,
Ubuntu, Cantarell, 'Noto Sans', sans-serif;
--ifm-heading-font-family: var(--ifm-font-family-base);
--ifm-heading-font-weight: 600;
--ifm-font-family-monospace: 'JetBrains Mono', 'JetBrains Mono Fallback', SFMono-Regular, Menlo,
Consolas, monospace;
--ifm-container-width-xl: 1400px;
--docusaurus-highlighted-code-line-bg: var(--cgp-highlight-line);
--ifm-scrollbar-track-background-color: transparent;
--ifm-scrollbar-thumb-background-color: var(--ifm-color-emphasis-400);
--ifm-scrollbar-thumb-hover-background-color: var(--ifm-color-emphasis-500);
/* Infima: admonitions. `note` uses secondary, `tip` success, `info` info, `warning` warning, and
`danger` danger. The four kinds the site uses sit away from the brand red, so a link never looks
like an admonition; `danger`, which no page uses, keeps a red distinct from the brand's. */
--ifm-color-info: #4f7387;
--ifm-color-info-dark: #4f7387;
--ifm-color-info-contrast-background: #edf3f6;
--ifm-color-info-contrast-foreground: #1c2f3a;
--ifm-color-success: #4a7a55;
--ifm-color-success-dark: #4a7a55;
--ifm-color-success-contrast-background: #edf4ee;
--ifm-color-success-contrast-foreground: #1b3522;
--ifm-color-secondary: #e9e0da;
--ifm-color-secondary-dark: #95857e;
--ifm-color-secondary-contrast-background: #f4efeb;
--ifm-color-secondary-contrast-foreground: #362b28;
--ifm-color-warning: #b9821f;
--ifm-color-warning-dark: #b9821f;
--ifm-color-warning-contrast-background: #fbf3e2;
--ifm-color-warning-contrast-foreground: #45300c;
--ifm-color-danger: #c4372b;
--ifm-color-danger-dark: #c4372b;
--ifm-color-danger-contrast-background: #fcebe9;
--ifm-color-danger-contrast-foreground: #4a1111;
}
/* The dark theme. It redefines the tints of the red scale that it uses, so a tint keeps its role in
both themes: `--cgp-red-50`, for example, is the faint surface behind the active sidebar item. */
html[data-theme='dark'] {
--cgp-red-50: #2a1716;
--cgp-red-100: #3a1b19;
--cgp-red-300: #c9584f;
--cgp-red-400: #e0766c;
--cgp-red-500: #ef8f86;
--cgp-bg: #0e0c0c;
--cgp-surface: #171414;
--cgp-surface-raised: #1f1b1a;
--cgp-border: #332c2b;
--cgp-text: #ece3df;
--cgp-text-muted: #b3a39e;
--cgp-heading: #f7f0ed;
--cgp-link: #ef8f86;
--cgp-link-hover: #f7b6ae;
--cgp-focus: #ef8f86;
--cgp-code-bg: #191515;
--cgp-inline-code-bg: #262120;
--cgp-highlight-line: rgba(230, 170, 60, 0.14);
--cgp-diff-removed: rgba(232, 116, 106, 0.14);
--cgp-diff-added: rgba(100, 200, 120, 0.16);
--cgp-diff-added-mark: #7cc58a;
--cgp-selection: rgba(239, 143, 134, 0.28);
--cgp-image-frame: #fdfaf7;
--cgp-announce-bg: #1c1818;
--cgp-announce-text: #f1e7e4;
--cgp-footer-bg: #2b0c0b;
--cgp-footer-text: #eee4e1;
--cgp-footer-title: #ffffff;
--cgp-footer-link: #f8efec;
--ifm-color-primary: #ef8f86;
--ifm-color-primary-dark: #ec7d72;
--ifm-color-primary-darker: #ea7369;
--ifm-color-primary-darkest: #e2554a;
--ifm-color-primary-light: #f2a19a;
--ifm-color-primary-lighter: #f4aba4;
--ifm-color-primary-lightest: #f8c9c4;
--ifm-color-emphasis-0: #0e0c0c;
--ifm-color-emphasis-100: #1a1716;
--ifm-color-emphasis-200: #262120;
--ifm-color-emphasis-300: #3b3332;
--ifm-color-emphasis-400: #5d4d4a;
--ifm-color-emphasis-500: #7f6d69;
--ifm-color-emphasis-600: #a3918c;
--ifm-color-emphasis-700: #c1b2ad;
--ifm-color-emphasis-800: #dccfca;
--ifm-color-emphasis-900: #ede4e0;
--ifm-color-emphasis-1000: #fbf7f5;
--ifm-color-content: var(--cgp-text);
--ifm-color-content-secondary: var(--cgp-text-muted);
--ifm-color-primary-contrast-background: var(--cgp-red-50);
--ifm-color-primary-contrast-foreground: #f8e1dd;
--ifm-background-color: var(--cgp-bg);
--ifm-background-surface-color: var(--cgp-surface);
--ifm-font-color-base: var(--cgp-text);
--ifm-font-color-secondary: var(--cgp-text-muted);
--ifm-heading-color: var(--cgp-heading);
--ifm-link-color: var(--cgp-link);
--ifm-link-hover-color: var(--cgp-link-hover);
--ifm-navbar-background-color: var(--cgp-bg);
--ifm-navbar-link-color: var(--cgp-text);
--ifm-navbar-link-hover-color: var(--cgp-link);
--ifm-menu-color: var(--cgp-text-muted);
--ifm-menu-color-active: var(--cgp-link);
--ifm-menu-color-background-active: var(--cgp-red-50);
--ifm-menu-color-background-hover: var(--ifm-color-emphasis-100);
--ifm-toc-border-color: var(--cgp-border);
--ifm-hr-background-color: var(--cgp-border);
--ifm-table-border-color: var(--cgp-border);
--ifm-table-stripe-background: rgba(236, 227, 223, 0.03);
--ifm-table-head-background: var(--cgp-surface);
--ifm-code-background: var(--cgp-inline-code-bg);
--ifm-pre-background: var(--cgp-code-bg);
--ifm-card-background-color: var(--cgp-surface-raised);
--ifm-dropdown-background-color: var(--cgp-surface-raised);
--ifm-breadcrumb-item-background-active: var(--cgp-red-50);
--docusaurus-highlighted-code-line-bg: var(--cgp-highlight-line);
--ifm-scrollbar-track-background-color: transparent;
--ifm-scrollbar-thumb-background-color: var(--ifm-color-emphasis-400);
--ifm-scrollbar-thumb-hover-background-color: var(--ifm-color-emphasis-500);
--ifm-color-info: #7ea3b7;
--ifm-color-info-dark: #7ea3b7;
--ifm-color-info-contrast-background: #1a2328;
--ifm-color-info-contrast-foreground: #d7e4eb;
--ifm-color-success: #79a884;
--ifm-color-success-dark: #79a884;
--ifm-color-success-contrast-background: #18231b;
--ifm-color-success-contrast-foreground: #d4e8d9;
--ifm-color-secondary: #332c2b;
--ifm-color-secondary-dark: #8d7c76;
--ifm-color-secondary-contrast-background: #1b1717;
--ifm-color-secondary-contrast-foreground: #e6dcd8;
--ifm-color-warning: #d4a246;
--ifm-color-warning-dark: #d4a246;
--ifm-color-warning-contrast-background: #2a2114;
--ifm-color-warning-contrast-foreground: #f1e1c2;
--ifm-color-danger: #e8746a;
--ifm-color-danger-dark: #e8746a;
--ifm-color-danger-contrast-background: #2c1716;
--ifm-color-danger-contrast-foreground: #f3d4d0;
}
/* Inline code and links inside an admonition get a tint of the admonition's own hue, in place of
Infima's bright green, blue, and red. */
.alert--info {
--ifm-alert-background-color-highlight: rgba(79, 115, 135, 0.14);
}
.alert--success {
--ifm-alert-background-color-highlight: rgba(74, 122, 85, 0.14);
}
.alert--secondary {
--ifm-alert-background-color-highlight: rgba(149, 133, 126, 0.16);
}
.alert--warning {
--ifm-alert-background-color-highlight: rgba(185, 130, 31, 0.14);
}
.alert--danger {
--ifm-alert-background-color-highlight: rgba(196, 55, 43, 0.12);
}
/* Code shows the characters a reader types, so `->` and `=>` never join into one glyph. JetBrains
Mono's regular weight looks thin beside Inter, so code sets at 500, except inside bold text,
headings, and table headers, where it keeps the weight around it. */
code,
pre,
kbd {
font-variant-ligatures: none;
font-weight: 500;
}
:is(strong, b, th, h1, h2, h3, h4, h5, h6) :is(code, kbd) {
font-weight: inherit;
}
.navbar__title {
font-family: var(--ifm-heading-font-family);
}
/* Firefox styles scrollbars only through `scrollbar-color`, so the sidebar's thin scrollbar takes the
theme's colours there too, instead of a white track beside the dark sidebar. */
.thin-scrollbar {
scrollbar-color: var(--ifm-scrollbar-thumb-background-color)
var(--ifm-scrollbar-track-background-color);
}
::selection {
background-color: var(--cgp-selection);
}
/* A visible focus ring on every link, button, and control. */
:focus-visible {
outline: 2px solid var(--cgp-focus);
outline-offset: 2px;
border-radius: 2px;
}
/* Prose links are underlined, because colour alone does not separate them from body text. Heading
anchors and the generated category cards keep their own styles. */
.markdown a:not(.hash-link):not(.card) {
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 0.18em;
text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.markdown a:not(.hash-link):not(.card):hover {
text-decoration-color: currentColor;
}
/* The navbar sits on the page background with a hairline below it. */
.navbar {
box-shadow: none;
border-bottom: 1px solid var(--cgp-border);
}
/* The announcement bar takes its colours from the config, which points them at these tokens. */
.theme-announcement-bar {
font-size: 1.1em;
border-bottom: 1px solid var(--cgp-border);
}
.theme-announcement-bar a {
color: inherit;
}
/* The footer is a deep red in both themes. */
.footer--dark {
--ifm-footer-background-color: var(--cgp-footer-bg);
--ifm-footer-color: var(--cgp-footer-text);
--ifm-footer-link-color: var(--cgp-footer-link);
--ifm-footer-link-hover-color: var(--cgp-footer-title);
--ifm-footer-title-color: var(--cgp-footer-title);
}
.footer--dark a {
color: var(--cgp-footer-link);
}
/* Content images keep their light backgrounds, because an image loaded by <img> follows the operating
system's colour scheme rather than the site's switch. In the dark theme each one sits in a
paper-coloured frame, so it reads as a tile rather than a bright hole in the page. */
html[data-theme='dark'] .markdown img {
background-color: var(--cgp-image-frame);
border-radius: 12px;
padding: 0.5rem;
}
/* The footer's links share its text colour, so the links inside the licence line are underlined. */
.footer__copyright a {
text-decoration: underline;
text-underline-offset: 0.18em;
}
/* Infima's primary hero, which the blog archive's header uses, fills with the primary colour: the full
brand red in the light theme and a loud coral in the dark one. It takes the warm surface instead,
with the heading colour for its text. */
.hero--primary {
--ifm-hero-background-color: var(--cgp-surface);
--ifm-hero-text-color: var(--cgp-heading);
border-bottom: 1px solid var(--cgp-border);
}
/* The blog list's post titles are links set at heading size; they take the heading colour and turn
red on hover, so a page of posts does not read as a wall of red. */
article > header > h2 > a {
color: var(--ifm-heading-color);
}
article > header > h2 > a:hover {
color: var(--ifm-link-color);
text-decoration: none;
}