Skip to content

Commit 6779193

Browse files
feat(html): introduce dark theme (#697)
1 parent aef1632 commit 6779193

File tree

99 files changed

+1037
-722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1037
-722
lines changed

src/html/templates/breadcrumbs.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{~#if this.is_symbol~}}
1919
<span>.</span>
2020
{{~else~}}
21-
<span class="text-[#0F172A]">{{~> icons/arrow ~}}</span>
21+
<span class="text-black dark:text-white">{{~> icons/arrow ~}}</span>
2222
{{~/if~}}
2323
{{/unless}}
2424

src/html/templates/comrak.css

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.link {
2-
@apply text-blue-600 transition duration-75;
2+
@apply text-blue-600 transition duration-75 dark:text-blue-400;
33
}
44

55
.link:hover {
6-
@apply text-blue-400;
6+
@apply text-blue-400 dark:text-blue-500;
77
}
88

99
.markdown_summary, .markdown {
@@ -13,14 +13,34 @@
1313
}
1414

1515
.markdown_summary {
16-
@apply inline text-stone-600;
16+
@apply inline text-stone-600 dark:text-stone-400;
1717

1818
p {
1919
@apply inline-block line-clamp-4;
2020
}
2121

2222
:not(pre) > code {
23-
@apply font-mono text-sm py-0.5 px-1.5 rounded bg-stone-200;
23+
@apply font-mono text-sm py-0.5 px-1.5 rounded bg-stone-200
24+
dark:bg-stone-800;
25+
}
26+
}
27+
28+
.context_button {
29+
@apply absolute top-3 right-4 opacity-60 hover:opacity-100 active:opacity-100
30+
transition duration-75;
31+
32+
svg.check {
33+
@apply hidden;
34+
}
35+
36+
&.copied {
37+
svg.copy {
38+
@apply hidden;
39+
}
40+
41+
svg.check {
42+
@apply block;
43+
}
2444
}
2545
}
2646

@@ -29,11 +49,13 @@
2949
md:max-w-screen-md lg:max-w-[75ch];
3050

3151
h1 {
32-
@apply text-xl md:text-2xl lg:text-3xl border-b border-stone-300 pb-1;
52+
@apply text-xl md:text-2xl lg:text-3xl border-b border-stone-300 pb-1
53+
dark:border-stone-700;
3354
}
3455

3556
h2 {
36-
@apply text-lg md:text-xl lg:text-2xl border-b border-stone-300 pb-1;
57+
@apply text-lg md:text-xl lg:text-2xl border-b border-stone-300 pb-1
58+
dark:border-stone-700;
3759
}
3860

3961
h3 {
@@ -53,7 +75,7 @@
5375
}
5476

5577
hr {
56-
@apply m-2 border-stone-500;
78+
@apply m-2 border-stone-500 dark:border-stone-400;
5779
}
5880

5981
ol, ul {
@@ -70,7 +92,8 @@
7092

7193
/* Inline code */
7294
:not(pre) > code {
73-
@apply font-mono text-sm py-0.5 px-1.5 rounded-md bg-stone-200;
95+
@apply font-mono text-sm py-0.5 px-1.5 rounded-md bg-stone-200
96+
dark:bg-stone-800;
7497
}
7598

7699
h1, h2, h3, h4, h5, h6 {
@@ -81,7 +104,8 @@
81104

82105
pre {
83106
@apply font-mono text-sm text-black bg-slate-50 border-t-1.5 border-b-1.5
84-
border-slate-300 -mx-4 rounded-none md:rounded-md md:border-1.5 md:mx-0;
107+
border-slate-300 -mx-4 rounded-none md:rounded-md md:border-1.5 md:mx-0
108+
dark:bg-stone-800 dark:border-gray-600;
85109

86110
& > code:first-child {
87111
@apply overflow-x-auto px-6 py-4 block;
@@ -105,11 +129,11 @@
105129
}
106130

107131
th, td {
108-
@apply border-1.5 border-slate-300;
132+
@apply border-1.5 border-slate-300 dark:border-stone-700;
109133
}
110134

111135
tr:nth-child(2n) {
112-
@apply bg-slate-50;
136+
@apply bg-slate-50 dark:bg-stone-800;
113137
}
114138

115139
img {
@@ -129,68 +153,55 @@
129153
}
130154

131155
.alert-note {
132-
@apply border-blue-600 bg-blue-600/5;
156+
@apply border-blue-600 bg-blue-600/5 dark:bg-blue-600/5;
133157

134158
div:first-child {
135-
@apply text-blue-600 stroke-blue-600;
159+
@apply text-blue-600 stroke-blue-600 dark:text-blue-600
160+
dark:stroke-blue-600;
136161
}
137162
}
138163

139164
.alert-tip {
140-
@apply border-green-600 bg-green-600/5;
165+
@apply border-green-600 bg-green-600/5 dark:bg-green-600/5;
141166

142167
div:first-child {
143-
@apply text-green-600 stroke-green-600;
168+
@apply text-green-600 stroke-green-600 dark:text-green-600
169+
dark:stroke-green-600;
144170
}
145171
}
146172

147173
.alert-important {
148-
@apply border-purple-600 bg-purple-600/5;
174+
@apply border-purple-600 bg-purple-600/5 dark:bg-purple-600/5;
149175

150176
div:first-child {
151-
@apply text-purple-600 stroke-purple-600;
177+
@apply text-purple-600 stroke-purple-600 dark:text-purple-600
178+
dark:stroke-purple-600;
152179
}
153180
}
154181

155182
.alert-warning {
156-
@apply border-yellow-600 bg-yellow-600/5;
183+
@apply border-yellow-600 bg-yellow-600/5 dark:bg-yellow-600/5;
157184

158185
div:first-child {
159-
@apply text-yellow-600 stroke-yellow-600;
186+
@apply text-yellow-600 stroke-yellow-600 dark:text-yellow-600
187+
dark:stroke-yellow-600;
160188
}
161189
}
162190

163191
.alert-caution {
164-
@apply border-red-600 bg-red-600/5;
192+
@apply border-red-600 bg-red-600/5 dark:bg-red-600/5;
165193

166194
div:first-child {
167-
@apply text-red-600 stroke-red-600;
195+
@apply text-red-600 stroke-red-600 dark:text-red-600 dark:stroke-red-600;
168196
}
169197
}
170198
}
171199

172200
.markdown .highlight {
173-
@apply relative;
201+
@apply relative text-black bg-gray-50 dark:bg-gray-800 dark:text-white;
174202

175203
.lineNumbers {
176-
@apply border-r-2 border-stone-300 pr-1 text-right flex-none;
177-
}
178-
179-
.context_button {
180-
@apply absolute top-3 right-4 opacity-60 hover:opacity-100;
181-
182-
svg.check {
183-
@apply hidden;
184-
}
185-
186-
&.copied {
187-
svg.copy {
188-
@apply hidden;
189-
}
190-
191-
svg.check {
192-
@apply block;
193-
}
194-
}
204+
@apply border-r-2 border-gray-300 pr-1 text-right flex-none
205+
dark:border-gray-600;
195206
}
196207
}

src/html/templates/comrak.gen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/html/templates/doc_entry.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<span class="font-bold font-lg">{{{name}}}</span>
2323
{{~/if~}}
2424
{{~/if~}}
25-
<span class="font-medium text-stone-500">{{{content}}}</span>
25+
<span class="font-medium text-stone-500 dark:text-stone-200">{{{content}}}</span>
2626
</code>
2727
</div>
2828

src/html/templates/doc_node_kind_icon.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="docNodeKindIcon">
22
{{~#each this~}}
3-
<div class="text-{{this.kind}} bg-{{this.kind}}/15" title="{{this.title}}">
3+
<div class="text-{{this.kind}} bg-{{this.kind}}/15 dark:text-{{this.kind}}Dark dark:bg-{{this.kind}}Dark/15" title="{{this.title}}">
44
{{~this.char~}}
55
</div>
66
{{~/each~}}

src/html/templates/function.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{~> symbol_content this.content ~}}
1313
</div>
1414
{{~#if (not @last)~}}
15-
<div class="border-b border-gray-300 max-w-[75ch]"></div>
15+
<div class="border-b border-gray-300 max-w-[75ch] dark:border-gray-700"></div>
1616
{{~/if~}}
1717
{{~/each~}}
1818
</div>

src/html/templates/icons/check.svg

Lines changed: 1 addition & 1 deletion
Loading

src/html/templates/icons/copy.svg

Lines changed: 1 addition & 1 deletion
Loading

src/html/templates/pages/page.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
@tailwind components;
22
@tailwind utilities;
33

4+
body {
5+
@apply bg-white dark:bg-backgroundDark text-black dark:text-white;
6+
}
7+
48
.ddoc {
5-
/* keep spacing in sync with #topnav in various places further down */
6-
@apply flex min-h-fit items-start gap-6 p-4;
9+
/*
10+
keep spacing in sync with #topnav in various places further down
11+
de-dup body styles to unsure compatibility `@deno/doc`
12+
*/
13+
@apply flex bg-white items-start gap-6 p-4 dark:bg-backgroundDark
14+
dark:text-white;
715

816
&:has(#categoryPanel) {
917
@apply lg:p-2;

src/html/templates/pages/page.gen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)