Skip to content

Commit 31e795b

Browse files
authored
Guides dark mode fixes (rails#51372)
* Disabling font-smoothing as it reduces legibility in post-deploy testing The font ends up feeling lighter when this is applied in both light and dark mode. While it provides more precise font rendering, it doesn’t seem to be actually helping on the body text here, so I think we should strike it. * Dark mode fixes and improvements * Removing highlight behind code in TD * more subtle subCol background shift * White H1, h2 in dark mode * Fixing anchor vs h2 anchor * Fixing a pre/code regression on table code lines * Fixing Safari faux-bold issue in code blocks. * Removing double line on index * Removing footer inversion in dark mode * Fixing layout width for larger screens (mimics existing) * ADditional fixes on layout * First stab at scrollbar colors * White Rails HR for dark mode * Compresison on new construction sign SVG * Fixing subCol oddities * Fixing nav spacing regression
1 parent abbbf19 commit 31e795b

File tree

7 files changed

+278
-194
lines changed

7 files changed

+278
-194
lines changed
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 1 deletion
Loading

guides/assets/stylesrc/_dark.scss

Lines changed: 103 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,53 @@
77

88
@media (prefers-color-scheme: dark) {
99
body.guide {
10+
1011
background-color: $gray-900;
1112
color: #fff;
1213

14+
&::-webkit-scrollbar {
15+
width: 12px;
16+
background-color: transparent;
17+
}
18+
19+
&::-webkit-scrollbar-track {
20+
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
21+
border-radius: 10px;
22+
background-color: $gray-900;
23+
}
24+
25+
&::-webkit-scrollbar-thumb {
26+
background-color: $gray-500;
27+
border-radius: 10px;
28+
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
29+
}
30+
h1 {
31+
color: #fff;
32+
}
33+
1334
a {
1435
&:link {
15-
color: $rf-brand-light;
36+
color: $rf-brand-lightest;
1637
}
1738
&:hover,
1839
&:active {
19-
color: $rf-brand-darker;
40+
color: $rf-brand-lighter;
2041
} // &:hover, &:active
2142
&:visited {
22-
color: $rf-brand;
43+
color: $rf-brand-lightest;
2344
} // &:visited
2445
} // a
46+
47+
h2 a {
48+
&:link,
49+
&:visited {
50+
color: #fff;
51+
}
52+
} // h2 a
2553

2654
table {
2755
th {
28-
color: $gray-900;
29-
background-color: $gray-200;
56+
background-color: $gray-1000;
3057
} // th
3158

3259
tr {
@@ -44,13 +71,27 @@
4471
} // a, a:link, a:visited
4572
} // h3
4673

74+
hr {
75+
background: url("../images/hr_rails_white.svg") center no-repeat;
76+
}
77+
4778
pre, code {
48-
background-color: $gray-200;
49-
color: $gray-200;
79+
background-color: $gray-1000;
80+
color: #fff;
5081
} // pre, code
5182

52-
p code, ul code, li code, h2 code, h3 code, h4 code, h5 code, td code {
53-
background-color: $gray-600;
83+
p code, ul code, li code {
84+
background-color: $gray-650;
85+
color: #fff;
86+
}
87+
88+
td code {
89+
background-color: transparent;
90+
}
91+
92+
h2 code, h3 code, h4 code, h5 code {
93+
background-color: transparent;
94+
color: #fff;
5495
}
5596

5697
nav#topNav {
@@ -114,16 +155,12 @@
114155

115156
a:hover,
116157
a:active {
117-
color: $rf-brand-light;
158+
color: $rf-brand-lighter;
118159
} // a:hover
119160
} // dd
120161
} // .guides-section
121162
} // #guides
122163

123-
footer#page_footer {
124-
background-color: $gray-200;
125-
color: $gray-900;
126-
} // footer#page_footer
127164

128165
#feature {
129166
background-color: $gray-800;
@@ -133,9 +170,28 @@
133170
}
134171

135172
#subCol {
136-
background-color: $gray-700;
137-
138-
ol {
173+
background-color: $gray-800;
174+
175+
ol.chapters {
176+
&::-webkit-scrollbar {
177+
background-color: $gray-700;
178+
}
179+
180+
&::-webkit-scrollbar-track {
181+
background-color: $gray-700;
182+
border-radius: 5px;
183+
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
184+
}
185+
186+
&::-webkit-scrollbar-thumb {
187+
background-image: -webkit-gradient(linear,
188+
left bottom,
189+
left top,
190+
color-stop(0.44, $rf-brand-lightest),
191+
color-stop(0.86, $rf-brand-lighter));
192+
border-radius: 5px;
193+
box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
194+
}
139195
li {
140196
a,
141197
a:link,
@@ -145,15 +201,41 @@
145201

146202
a:hover,
147203
a:active {
148-
color: $rf-brand-light;
204+
color: $rf-brand-lighter;
149205
} // a
150206
} // li
151207
} // ol
152208
} // #subCol
153209
} // #feature
154210

155-
.interstitial.code {
156-
background-color: $gray-200;
157-
}
211+
.interstitial {
212+
&.code {
213+
background-color: $gray-1000;
214+
color: $gray-200;
215+
}
216+
&.note,
217+
&.work-in-progress,
218+
&.todo {
219+
border-color: $note-dark;
220+
background-color: $note-bkgnd-dark;
221+
}
222+
223+
&.info {
224+
border-color: $tip-dark;
225+
background-color: $tip-bkgnd-dark;
226+
}
227+
228+
&.warning {
229+
border-color: $stop-dark;
230+
background-color: $stop-bkgnd-dark;
231+
}
232+
233+
&.question {
234+
border-color: $gray-600;
235+
background-color: $gray-700;
236+
}
237+
238+
239+
}
158240
} // body.guide
159241
} // @media (prefers-color-scheme: dark

0 commit comments

Comments
 (0)