Skip to content

Commit 890caa2

Browse files
committed
Move per-theme CSS variables to top
When defining colors relative to other colors defined per theme, it's helpful to have these all defined as variables and have all the variables defined in one place. Let's do that.
1 parent 0e6e036 commit 890caa2

File tree

1 file changed

+51
-58
lines changed

1 file changed

+51
-58
lines changed

theme/reference.css

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
/* Custom CSS for the Rust Specification. */
22

3+
/* Per-theme variables. */
4+
:root {
5+
--railroad-background-color: hsl(30, 20%, 95%);
6+
--railroad-background-image:
7+
linear-gradient(to right, rgba(30, 30, 30, .05) 1px, transparent 1px),
8+
linear-gradient(to bottom, rgba(30, 30, 30, .05) 1px, transparent 1px);
9+
--railroad-path-stroke: black;
10+
--railroad-rect-stroke: black;
11+
--railroad-rect-fill: hsl(-290, 70%, 90%);
12+
}
13+
.light {
14+
--alert-note-color: #0969da;
15+
--alert-warning-color: #9a6700;
16+
--alert-edition-color: #1a7f37;
17+
--alert-example-color: #8250df;
18+
--gramar-literal-bg: #fafafa;
19+
}
20+
.rust {
21+
--alert-note-color: #023b95;
22+
--alert-warning-color: #603700;
23+
--alert-edition-color: #008200;
24+
--alert-example-color: #8250df;
25+
--grammar-literal-bg: #dedede;
26+
}
27+
.coal, .navy {
28+
--alert-note-color: #4493f8;
29+
--alert-warning-color: #d29922;
30+
--alert-edition-color: #3fb950;
31+
--alert-example-color: #ab7df8;
32+
--grammar-literal-bg: #1d1f21;
33+
}
34+
.ayu {
35+
--alert-note-color: #74b9ff;
36+
--alert-warning-color: #f0b72f;
37+
--alert-edition-color: #2bd853;
38+
--alert-example-color: #d3abff;
39+
--gramar-literal-bg: #191f26;
40+
}
41+
.coal, .navy, .ayu {
42+
--railroad-background-color: hsl(230, 10%, 20%);
43+
--railroad-background-image:
44+
linear-gradient(to right, rgba(150, 150, 150, .05) 1px, transparent 1px),
45+
linear-gradient(to bottom, rgba(150, 150, 150, .05) 1px, transparent 1px);
46+
--railroad-path-stroke: hsl(200, 10%, 60%);
47+
--railroad-text-fill: hsl(230, 30%, 80%);
48+
--railroad-rect-stroke: hsl(200, 10%, 50%);
49+
--railroad-rect-fill: hsl(230, 20%, 20%);
50+
}
51+
352
/*
453
.parenthetical class used to keep e.g. "less-than symbol (<)" from wrapping
554
the end parenthesis onto its own line. Use in a span between the last word and
@@ -58,31 +107,6 @@ See mdbook-spec/src/admonitions.rs.
58107
margin-right: 8px;
59108
}
60109

61-
.light .alert {
62-
--alert-note-color: #0969da;
63-
--alert-warning-color: #9a6700;
64-
--alert-edition-color: #1a7f37;
65-
--alert-example-color: #8250df;
66-
}
67-
.ayu .alert {
68-
--alert-note-color: #74b9ff;
69-
--alert-warning-color: #f0b72f;
70-
--alert-edition-color: #2bd853;
71-
--alert-example-color: #d3abff;
72-
}
73-
.rust .alert {
74-
--alert-note-color: #023b95;
75-
--alert-warning-color: #603700;
76-
--alert-edition-color: #008200;
77-
--alert-example-color: #8250df;
78-
}
79-
.coal .alert,
80-
.navy .alert {
81-
--alert-note-color: #4493f8;
82-
--alert-warning-color: #d29922;
83-
--alert-edition-color: #3fb950;
84-
--alert-example-color: #ab7df8;
85-
}
86110
.alert-note blockquote {
87111
border-inline-start-color: var(--alert-note-color);
88112
}
@@ -596,20 +620,8 @@ main > .rule {
596620
color: var(--inline-code-color);
597621
}
598622

599-
.light .grammar-literal {
600-
background-color: #fafafa;
601-
}
602-
.rust .grammar-literal {
603-
background-color: #dedede;
604-
}
605-
.coal .grammar-literal {
606-
background-color: #1d1f21;
607-
}
608-
.navy .grammar-literal {
609-
background-color: #1d1f21;
610-
}
611-
.ayu .grammar-literal {
612-
background-color: #191f26;
623+
.grammar-literal {
624+
background-color: var(--grammar-literal-bg);
613625
}
614626

615627
.grammar-production:target, .railroad-production:target {
@@ -653,25 +665,6 @@ main > .rule {
653665
display: none;
654666
}
655667

656-
:root {
657-
--railroad-background-color: hsl(30, 20%, 95%);
658-
--railroad-background-image: linear-gradient(to right, rgba(30, 30, 30, .05) 1px, transparent 1px),
659-
linear-gradient(to bottom, rgba(30, 30, 30, .05) 1px, transparent 1px);
660-
--railroad-path-stroke: black;
661-
--railroad-rect-stroke: black;
662-
--railroad-rect-fill: hsl(-290, 70%, 90%);
663-
}
664-
665-
.coal, .navy, .ayu {
666-
--railroad-background-color: hsl(230, 10%, 20%);
667-
--railroad-background-image: linear-gradient(to right, rgba(150, 150, 150, .05) 1px, transparent 1px),
668-
linear-gradient(to bottom, rgba(150, 150, 150, .05) 1px, transparent 1px);
669-
--railroad-path-stroke: hsl(200, 10%, 60%);
670-
--railroad-text-fill: hsl(230, 30%, 80%);
671-
--railroad-rect-stroke: hsl(200, 10%, 50%);
672-
--railroad-rect-fill: hsl(230, 20%, 20%);
673-
}
674-
675668
svg.railroad {
676669
background-color: var(--railroad-background-color);
677670
background-size: 15px 15px;

0 commit comments

Comments
 (0)