Skip to content

Commit 89223e1

Browse files
authored
Merge pull request #64 from Skona-Advertising/master
Dark Mode CSS
2 parents c5d4aed + cafb0be commit 89223e1

File tree

7 files changed

+133
-4
lines changed

7 files changed

+133
-4
lines changed

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ module.exports = {
118118
colorMode: {
119119
// Hides the switch in the navbar
120120
// Useful if you want to support a single color mode
121-
disableSwitch: true,
121+
disableSwitch: false,
122122
},
123123
announcementBar: {
124124
id: 'redisconf20201cfp', // Any value that will identify this message.

src/css/_article.scss

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525

2626
--ifm-tabs-color: var(--black);
2727
--ifm-tabs-color-active: var(--purple);
28+
29+
--ifm-code-color: var(--black);
30+
}
31+
32+
html[data-theme="dark"] {
33+
--ifm-menu-color: var(--white);
34+
--ifm-menu-color-active: #829EF0;
35+
--ifm-menu-color-background-active: #181D27;
36+
--ifm-menu-color-background-hover: #181D27;
37+
--ifm-toc-border-color: #676768;
38+
--ifm-toc-link-color: var(--white);
39+
--ifm-code-color: var(--white);
2840
}
2941

3042
hr {
@@ -73,6 +85,7 @@ hr {
7385

7486
li {
7587
margin-right: 0;
88+
line-height: 1.5;
7689
}
7790

7891
&__link {
@@ -85,6 +98,10 @@ hr {
8598
font-weight: 700;
8699
color: $purple;
87100

101+
@include dark {
102+
color: #829EF0;
103+
}
104+
88105
&:before {
89106
position: absolute;
90107
top: 0;
@@ -93,6 +110,24 @@ hr {
93110
height: 100%;
94111
background-color: $purple;
95112
content: '';
113+
114+
@include dark {
115+
background-color: #829EF0;
116+
}
117+
}
118+
}
119+
120+
&:hover {
121+
@include dark {
122+
color: #829EF0;
123+
}
124+
}
125+
126+
code {
127+
color: $black !important;
128+
129+
@include dark {
130+
color: $white !important;
96131
}
97132
}
98133
}
@@ -108,6 +143,11 @@ hr {
108143

109144
blockquote {
110145
border-left: 5px solid #dbdada;
146+
147+
@include dark {
148+
border-color: #676768;
149+
color: $white;
150+
}
111151
}
112152

113153
main:not(.home-main) {
@@ -117,6 +157,10 @@ main:not(.home-main) {
117157

118158
&:hover {
119159
color: $purple-hover;
160+
161+
@include dark {
162+
color: #829EF0;
163+
}
120164
}
121165
}
122166

@@ -130,6 +174,10 @@ main:not(.home-main) {
130174
@include mobile {
131175
font-size: 39px;
132176
}
177+
178+
@include dark {
179+
color: $white;
180+
}
133181
}
134182
}
135183
}
@@ -138,6 +186,10 @@ main:not(.home-main) {
138186
.markdown {
139187
color: $black;
140188

189+
@include dark {
190+
color: $white;
191+
}
192+
141193
h1,
142194
h2,
143195
h3,
@@ -257,6 +309,10 @@ main:not(.home-main) {
257309
.tabs {
258310
border-bottom: 1px solid $grey-light;
259311

312+
@include dark {
313+
border-color: #676768;
314+
}
315+
260316
&__item {
261317
margin-top: 0 !important;
262318
padding: 0 10px 10px;
@@ -265,13 +321,21 @@ main:not(.home-main) {
265321
font-size: 17px;
266322
transition: color .2s ease-in-out;
267323

324+
@include dark {
325+
color: $white;
326+
}
327+
268328
&:not(:last-child) {
269329
margin-right: 10px;
270330
}
271331

272332
&:hover {
273333
background-color: transparent;
274-
color: $purple-hover;
334+
color: $purple-hover !important;
335+
336+
@include dark {
337+
color: #829EF0 !important;
338+
}
275339
}
276340

277341
&--active {
@@ -289,8 +353,20 @@ main:not(.home-main) {
289353
box-shadow: 0px 4px 7px rgba(196, 196, 196, .5);
290354
transition: border-color .2s ease-in-out;
291355

356+
@include dark {
357+
background-color: #2a2c2d;
358+
border-color: #2a2c2d;
359+
box-shadow: none;
360+
color: $white;
361+
}
362+
292363
&.ri-link:hover {
293364
border-color: $purple;
365+
366+
@include dark {
367+
border-color: $purple-hover;
368+
background-color: #2a2b2d;
369+
}
294370
}
295371

296372
.ri-card-link {
@@ -320,6 +396,14 @@ main:not(.home-main) {
320396

321397
a {
322398
color: $black;
399+
400+
@include dark {
401+
color: $white;
402+
403+
&:hover {
404+
color: #829EF0;
405+
}
406+
}
323407
}
324408
}
325409

@@ -328,6 +412,10 @@ main:not(.home-main) {
328412
font-size: 16px;
329413
color: $black;
330414

415+
@include dark {
416+
color: $white;
417+
}
418+
331419
img {
332420
margin-top: 15px;
333421
}
@@ -341,6 +429,10 @@ main:not(.home-main) {
341429
code {
342430
border-radius: 4px;
343431
background-color: $purple-light;
432+
433+
@include dark {
434+
background-color: #3E44AC;
435+
}
344436
}
345437

346438
iframe {

src/css/_config.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ monospace;
3838
--purple-lighter: #F9FAFF;
3939
}
4040

41+
/* dark mode */
42+
43+
@mixin dark {
44+
html[data-theme="dark"] & {
45+
@content;
46+
}
47+
}
48+
4149
/* media queries */
4250
@mixin desktop {
4351
@media only screen and (min-width: 997px) {

src/css/_typography.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ h6 {
99

1010
// section-title
1111
.section-title {
12+
z-index: 2;
13+
position: relative;
1214
margin: 0;
1315
text-align: center;
1416
line-height: 1.15;
@@ -19,6 +21,10 @@ h6 {
1921
font-size: 32px;
2022
}
2123

24+
@include dark {
25+
color: $white;
26+
}
27+
2228
&.white {
2329
color: $white;
2430
}
@@ -44,6 +50,10 @@ h6 {
4450
font-size: 16px;
4551
}
4652

53+
@include dark {
54+
color: $white;
55+
}
56+
4757
&:not(:first-child) {
4858
margin-top: 11px;
4959

src/css/components/_demos.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
position: absolute;
3131
top: -37px;
3232
left: -109px;
33-
height: 477.5px;
3433
user-select: none;
34+
35+
@include dark {
36+
opacity: .4;
37+
}
3538
}
3639

3740
.col {
@@ -88,6 +91,10 @@
8891
min-height: 220px;
8992
}
9093

94+
@include dark {
95+
background-color: $primary-black;
96+
}
97+
9198
.title {
9299
margin: 0;
93100
line-height: 1;
@@ -96,6 +103,10 @@
96103
@include mobile {
97104
font-size: 22px;
98105
}
106+
107+
@include dark {
108+
color: $white;
109+
}
99110
}
100111

101112
.links {
@@ -127,8 +138,12 @@
127138
color: $primary-blue;
128139
transition: color .2s ease-in-out;
129140

141+
@include dark {
142+
color: $white;
143+
}
144+
130145
&:hover {
131-
color: $purple;
146+
color: $purple !important;
132147
}
133148
}
134149
}

src/css/custom.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
--ifm-global-radius: 10px;
4343
}
4444

45+
html[data-theme="dark"] {
46+
--ifm-background-color: var(--primary-black);
47+
}
48+
4549
.container {
4650
max-width: 1140px;
4751
}

static/img/code-1.png

-32.6 KB
Loading

0 commit comments

Comments
 (0)