Skip to content

Commit 3f30b6b

Browse files
Copilotjaypatrick
andauthored
Improve code block and table readability in dark theme (#205)
* Initial plan * Improve code samples and table styling for better readability Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
1 parent b3a9173 commit 3f30b6b

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

src/website/src/styles/global.css

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@
1212
--border-color: #e0e0e0;
1313
--link-color: #0066cc;
1414
--code-bg: #f5f5f5;
15+
--code-text: #1a1a1a;
16+
--code-keyword: #0000ff;
17+
--code-string: #008000;
18+
--code-comment: #808080;
1519
--header-bg: #1a1a1a;
1620
--nav-bg: #663399;
1721
--feature-bg: #fff;
1822
--hero-gradient-1: #663399;
1923
--hero-gradient-2: #1a1a1a;
24+
--table-header-bg: #f5f5f5;
25+
--table-row-even-bg: #fafafa;
26+
--table-row-odd-bg: #fff;
2027
}
2128

2229
[data-theme="dark"] {
@@ -26,12 +33,19 @@
2633
--bg-color: #1a1a1a;
2734
--border-color: #444;
2835
--link-color: #66b3ff;
29-
--code-bg: #2d2d2d;
36+
--code-bg: #1e1e1e;
37+
--code-text: #d4d4d4;
38+
--code-keyword: #569cd6;
39+
--code-string: #ce9178;
40+
--code-comment: #6a9955;
3041
--header-bg: #0a0a0a;
3142
--nav-bg: #7744bb;
3243
--feature-bg: #2d2d2d;
3344
--hero-gradient-1: #7744bb;
3445
--hero-gradient-2: #2d2d2d;
46+
--table-header-bg: #2d2d2d;
47+
--table-row-even-bg: #252525;
48+
--table-row-odd-bg: #1e1e1e;
3549
}
3650

3751
body {
@@ -197,41 +211,63 @@ main {
197211

198212
.doc-content code {
199213
background-color: var(--code-bg);
214+
color: var(--code-text);
200215
padding: 0.2rem 0.4rem;
201216
border-radius: 3px;
202-
font-family: "Monaco", "Courier New", monospace;
217+
font-family: "Monaco", "Consolas", "Courier New", monospace;
203218
font-size: 0.9em;
219+
font-weight: 500;
204220
}
205221

206222
.doc-content pre {
207223
background-color: var(--code-bg);
224+
color: var(--code-text);
208225
padding: 1rem;
209226
border-radius: 4px;
210227
overflow-x: auto;
211228
margin: 1rem 0;
229+
border: 1px solid var(--border-color);
230+
line-height: 1.5;
212231
}
213232

214233
.doc-content pre code {
215234
background-color: transparent;
216235
padding: 0;
236+
color: inherit;
237+
font-weight: 400;
217238
}
218239

219240
.doc-content table {
220241
width: 100%;
221242
border-collapse: collapse;
222243
margin: 1rem 0;
244+
border: 1px solid var(--border-color);
223245
}
224246

225247
.doc-content th,
226248
.doc-content td {
227249
border: 1px solid var(--border-color);
228-
padding: 0.5rem;
250+
padding: 0.75rem;
229251
text-align: left;
230252
}
231253

232254
.doc-content th {
233-
background-color: var(--code-bg);
255+
background-color: var(--table-header-bg);
234256
font-weight: 600;
257+
color: var(--text-color);
258+
}
259+
260+
.doc-content tbody tr:nth-child(even) {
261+
background-color: var(--table-row-even-bg);
262+
}
263+
264+
.doc-content tbody tr:nth-child(odd) {
265+
background-color: var(--table-row-odd-bg);
266+
}
267+
268+
.doc-content tbody tr:hover {
269+
background-color: var(--code-bg);
270+
transition: background-color 0.2s ease;
235271
}
236272

237273
footer {

0 commit comments

Comments
 (0)