Skip to content

Commit fd082a9

Browse files
authoredSep 10, 2024
Dark mode (#105)
1 parent 6cb424f commit fd082a9

File tree

1 file changed

+61
-11
lines changed

1 file changed

+61
-11
lines changed
 

‎main.scss

+61-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1+
$color-mode-type: media-query;
2+
13
@import "~bootstrap/scss/bootstrap";
24
@import "github-fork-ribbon-css/gh-fork-ribbon.css";
3-
@import "highlight.js/styles/github.css";
5+
6+
@import url('highlight.js/styles/github-dark.css') screen and (prefers-color-scheme: dark);
7+
@import url('highlight.js/styles/github.css') screen and (prefers-color-scheme: light);
48

59
#language-navbar {
610
border-bottom: none;
711
}
812

913
.nav-item > .nav-link {
1014
&.active, &:hover {
11-
background-color: #f8f8f8;
15+
background-color: #f6f8fa;
1216
border-bottom: none;
1317
transition: none;
1418
}
1519
}
20+
@media (prefers-color-scheme: dark) {
21+
.nav-item > .nav-link {
22+
&.active, &:hover {
23+
background-color: rgb(13, 17, 23);
24+
}
25+
}
26+
}
1627

1728
.nav-link {
1829
// Don't briefly draw a blue bar under Node.js dropdown after hovering over it
@@ -38,8 +49,18 @@
3849

3950
.nav.error > .nav-item > .nav-link {
4051
&.active, &:hover {
41-
background-color: #ffcdcd;
42-
border-color: #ffcdcd;
52+
color: #1f2328 !important;
53+
background-color: #ffebe9;
54+
border-color: #ffebe9;
55+
}
56+
}
57+
@media (prefers-color-scheme: dark) {
58+
.nav.error > .nav-item > .nav-link {
59+
&.active, &:hover {
60+
color: #fff !important;
61+
border-color: var(--bs-danger);
62+
background-color: var(--bs-danger);
63+
}
4364
}
4465
}
4566

@@ -59,18 +80,34 @@
5980
}
6081

6182
#generated-code {
62-
border-color: #f8f8f8;
63-
background-color: #f8f8f8;
83+
border-color: #f6f8fa;
84+
background-color: #f6f8fa;
85+
}
86+
@media (prefers-color-scheme: dark) {
87+
#generated-code {
88+
border-color: rgb(13, 17, 23);
89+
background-color: rgb(13, 17, 23);
90+
}
6491
}
6592

66-
#warnings {
67-
border-color: #ffffdd;
68-
background-color: #ffffdd;
6993

94+
#warnings {
7095
/* if the error is very long, without this the yellow stops when you scroll right */
7196
overflow-x: auto;
7297
min-width: 100%;
7398
}
99+
#warnings {
100+
color: #1f2328 !important;
101+
border-color: #fff8c5;
102+
background-color: #fff8c5;
103+
}
104+
@media (prefers-color-scheme: dark) {
105+
#warnings {
106+
color: #000 !important;
107+
border-color: var(--bs-warning);
108+
background-color: var(--bs-warning);
109+
}
110+
}
74111

75112
/* At least Chrome on macOS adds a bottom margin */
76113
pre {
@@ -85,11 +122,24 @@ code {
85122
#generated-code {
86123
display: block;
87124
overflow-x: auto;
125+
}
88126

127+
#generated-code {
89128
/* The output should be marked as plaintext only when there's an error. */
90129
&.language-plaintext {
91-
border-color: #ffcdcd;
92-
background-color: #ffcdcd;
130+
color: #1f2328 !important;
131+
background-color: #ffebe9;
132+
border-color: #ffebe9;
133+
}
134+
}
135+
@media (prefers-color-scheme: dark) {
136+
#generated-code {
137+
/* The output should be marked as plaintext only when there's an error. */
138+
&.language-plaintext {
139+
color: #fff !important;
140+
border-color: var(--bs-danger);
141+
background-color: var(--bs-danger);
142+
}
93143
}
94144
}
95145

0 commit comments

Comments
 (0)
Please sign in to comment.