Skip to content

Commit fc5adf3

Browse files
committed
Enable using CSS layers
Moving our Infima overrides to a `@layer docusaurus.*` felt wrong, but according to their docs and one maintainer-made PR, it's the correct thing. https://docusaurus.io/blog/releases/3.8#css-cascade-layers https://github.com/react/react-native-website/pull/4607/changes#diff-2ed4c9cb69fe6bf9f97448d3fd49b0f8a1fccabf3b4b7ef427dba9350852ec34R229
1 parent abbcf5d commit fc5adf3

2 files changed

Lines changed: 28 additions & 27 deletions

File tree

‎docusaurus.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const config = {
3939
future: {
4040
v4: {
4141
removeLegacyPostBuildHeadAttribute: true,
42-
useCssCascadeLayers: false, // Our custom CSS' Infima overrides need upgrading.
42+
useCssCascadeLayers: true,
4343
siteStorageNamespacing: true,
4444
fasterByDefault: true,
4545
mdx1CompatDisabledByDefault: true,

‎src/css/custom.css‎

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,40 @@ code, pre {
2121
font-weight: 500;
2222
}
2323

24-
25-
:root {
26-
--ifm-heading-font-family: "Akshar", sans-serif;
27-
--ifm-font-family-monospace: "JetBrains Mono", monospace;
28-
--ifm-color-primary: #332fd0;
29-
--ifm-color-primary-dark: #2e2abb;
30-
--ifm-color-primary-darker: #2b28b1;
31-
--ifm-color-primary-darkest: #242192;
32-
--ifm-color-primary-light: #4744d5;
33-
--ifm-color-primary-lighter: #524ed7;
34-
--ifm-color-primary-lightest: #706dde;
35-
--ifm-background-color: #f6f5f4;
36-
--ifm-h2-font-size: 2rem;
37-
--ifm-h3-font-size: 1.75rem;
38-
--ifm-h4-font-size: 1.5rem;
39-
--ifm-h5-font-size: 1.25rem;
24+
@layer docusaurus.infima {
25+
:root {
26+
--ifm-heading-font-family: "Akshar", sans-serif;
27+
--ifm-font-family-monospace: "JetBrains Mono", monospace;
28+
--ifm-color-primary: #332fd0;
29+
--ifm-color-primary-dark: #2e2abb;
30+
--ifm-color-primary-darker: #2b28b1;
31+
--ifm-color-primary-darkest: #242192;
32+
--ifm-color-primary-light: #4744d5;
33+
--ifm-color-primary-lighter: #524ed7;
34+
--ifm-color-primary-lightest: #706dde;
35+
--ifm-background-color: #f6f5f4;
36+
--ifm-h2-font-size: 2rem;
37+
--ifm-h3-font-size: 1.75rem;
38+
--ifm-h4-font-size: 1.5rem;
39+
--ifm-h5-font-size: 1.25rem;
40+
}
41+
42+
[data-theme="dark"] {
43+
--ifm-color-primary: #7cd5f1;
44+
--ifm-color-primary-dark: #5bcaed;
45+
--ifm-color-primary-darker: #4bc5ec;
46+
--ifm-color-primary-darkest: #19b5e6;
47+
--ifm-color-primary-light: #9de0f5;
48+
--ifm-color-primary-lighter: #ade5f6;
49+
--ifm-color-primary-lightest: #dff5fc;
50+
}
4051
}
4152

4253
/* Since the footer has always a dark background, user the dark-theme colors for links to ensure decent contrast */
4354
[data-theme="light"] .footer__link-item:hover, .footer a:hover, .footer__copyright a{
4455
color: #7cd5f1 !important;
4556
}
4657

47-
[data-theme="dark"] {
48-
--ifm-color-primary: #7cd5f1;
49-
--ifm-color-primary-dark: #5bcaed;
50-
--ifm-color-primary-darker: #4bc5ec;
51-
--ifm-color-primary-darkest: #19b5e6;
52-
--ifm-color-primary-light: #9de0f5;
53-
--ifm-color-primary-lighter: #ade5f6;
54-
--ifm-color-primary-lightest: #dff5fc;
55-
}
56-
5758
.docusaurus-highlight-code-line {
5859
background-color: rgba(0, 0, 0, 0.1);
5960
display: block;

0 commit comments

Comments
 (0)