Skip to content

Commit fce7bd1

Browse files
Nemo157GuillaumeGomez
authored andcommitted
Use namespaced data variable to store docs.rs' theme
1 parent f79c831 commit fce7bd1

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

templates/style/_syntax-themes.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ html {
1717
--color-syntax-string: #718c00;
1818
}
1919

20-
// To add a new theme, copy the above theme into a new `html[data-theme="name"]`
20+
// To add a new theme, copy the above theme into a new `html[data-docs-rs-theme="name"]`
2121
// block below and change the colors
2222

23-
html[data-theme="dark"] {
23+
html[data-docs-rs-theme="dark"] {
2424
--color-syntax-foreground: inherit;
2525
--color-syntax-attribute: #ee6868;
2626
--color-syntax-background: #2a2a2a;
@@ -39,7 +39,7 @@ html[data-theme="dark"] {
3939
--color-syntax-string: #83a300;
4040
}
4141

42-
html[data-theme="ayu"] {
42+
html[data-docs-rs-theme="ayu"] {
4343
--color-syntax-foreground: #e6e1cf;
4444
--color-syntax-attribute: #e6e1cf;
4545
--color-syntax-background: #191f26;

templates/style/_themes.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ html {
3232
--chart-grid: #ddd;
3333
}
3434

35-
// To add a new theme, copy the above theme into a new `html[data-theme="name"]`
35+
// To add a new theme, copy the above theme into a new `html[data-docs-rs-theme="name"]`
3636
// block below and change the colors
3737

38-
html[data-theme="dark"] {
38+
html[data-docs-rs-theme="dark"] {
3939
color-scheme: dark;
4040
--color-background-code: #2a2a2a;
4141
--color-background: #353535;
@@ -68,7 +68,7 @@ html[data-theme="dark"] {
6868
--chart-grid: #4e4e4e;
6969
}
7070

71-
html[data-theme="ayu"] {
71+
html[data-docs-rs-theme="ayu"] {
7272
color-scheme: dark;
7373
--color-background-code: #191f26;
7474
--color-background: #0f1419;

templates/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function() {
22
function applyTheme(theme) {
33
if (theme) {
4-
document.documentElement.dataset.theme = theme;
4+
document.documentElement.dataset.docsRsTheme = theme;
55
}
66
}
77

0 commit comments

Comments
 (0)