Skip to content

Commit 0237c79

Browse files
committed
feat: better table styling on plugin and blog pages
1 parent 2b62f91 commit 0237c79

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/assets/styles/reset.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ time, mark, audio, video {
2121
border: 0;
2222
font-size: 100%;
2323
font: inherit;
24-
vertical-align: baseline;
2524
}
2625
/* HTML5 display-role reset for older browsers */
2726
article, aside, details, figcaption, figure,

src/assets/styles/variables.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
--plugin-official-text: #594504;
5757
--font-family: "Noto Sans", "Segoe UI", "Inter", sans-serif;
5858
--font-family-mono: "Source Code Pro", "JetBrains Mono", "Fira Code", "Roboto Mono", monospace;
59+
--table-row-bg: #fff;
60+
--table-row-bg-alternate: #f7fbff;
61+
--table-cell-sep: #e0e8f0;
5962
}
6063

6164
:root[data-theme="dark"] {
@@ -107,4 +110,7 @@
107110
--theme-toggle-button-icon: #d8d8d8;
108111
--plugin-official-background: #594504;
109112
--plugin-official-text: #f2bd0c;
113+
--table-row-bg: #161b22;
114+
--table-row-bg-alternate: #0d1117;
115+
--table-cell-sep: #3b4554;
110116
}

src/layouts/Layout.astro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,27 @@ button {
230230
list-style: revert;
231231
}
232232

233+
.blog-content table {
234+
margin-bottom: 1em;
235+
}
236+
237+
.blog-content :is(th, td) {
238+
padding: 0.25em 0.5em;
239+
border: 1px solid var(--table-cell-sep);
240+
}
241+
242+
.blog-content thead tr :is(th, td) {
243+
background-color: var(--table-row-bg);
244+
}
245+
246+
.blog-content tbody tr:nth-child(odd) :is(th, td) {
247+
background-color: var(--table-row-bg-alternate);
248+
}
249+
250+
.blog-content tbody tr:nth-child(even) :is(th, td) {
251+
background-color: var(--table-row-bg);
252+
}
253+
233254
[data-theme="dark"] .astro-code,
234255
[data-theme="dark"] .astro-code span {
235256
color: var(--shiki-dark) !important;

0 commit comments

Comments
 (0)