Skip to content

Commit 130f325

Browse files
author
Noveris-Teams
committed
fix(ui): improve dark-mode article highlight contrast
Tune TOC active highlight and code/mark highlight contrast in dark theme.
1 parent 6812021 commit 130f325

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

src/styles/global.css

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,29 @@ a {
131131
padding-top: 2.6rem !important;
132132
}
133133

134+
.astro-code .line {
135+
display: block;
136+
margin: 0 -0.55rem;
137+
padding: 0 0.55rem;
138+
border-left: 2px solid transparent;
139+
}
140+
141+
.astro-code .line.highlighted,
142+
.astro-code .line[data-highlighted],
143+
.astro-code .line.diff.add,
144+
.astro-code .line.diff.remove {
145+
background: hsl(214 100% 95% / 0.95) !important;
146+
border-left-color: hsl(var(--accent) / 0.65);
147+
}
148+
149+
[data-theme='dark'] .astro-code .line.highlighted,
150+
[data-theme='dark'] .astro-code .line[data-highlighted],
151+
[data-theme='dark'] .astro-code .line.diff.add,
152+
[data-theme='dark'] .astro-code .line.diff.remove {
153+
background: hsl(214 100% 66% / 0.2) !important;
154+
border-left-color: hsl(212 100% 73%);
155+
}
156+
134157
[data-theme='light'] .astro-code,
135158
[data-theme='light'] .astro-code span {
136159
color: var(--shiki-light, #24292f) !important;
@@ -161,12 +184,17 @@ a {
161184

162185
.toc-link.is-active {
163186
color: hsl(var(--accent-strong));
164-
background: hsl(var(--accent) / 0.18);
187+
background: hsl(var(--accent) / 0.2);
188+
border-left: 2px solid hsl(var(--accent) / 0.72);
189+
padding-left: calc(0.5rem - 2px);
165190
font-weight: 700;
166191
}
167192

168193
[data-theme='dark'] .toc-link.is-active {
169-
color: hsl(var(--accent));
194+
color: hsl(210 100% 86%);
195+
background: hsl(212 100% 60% / 0.3);
196+
border-left-color: hsl(212 100% 73%);
197+
box-shadow: inset 0 0 0 1px hsl(212 100% 68% / 0.35);
170198
}
171199

172200
[data-toc-scroll] {
@@ -223,6 +251,20 @@ a {
223251
color: hsl(220 14% 74%);
224252
}
225253

254+
.prose :where(mark) {
255+
border-radius: 0.28rem;
256+
border: 1px solid hsl(41 98% 54% / 0.42);
257+
background: hsl(49 100% 75% / 0.5);
258+
color: hsl(224 46% 20%);
259+
padding: 0.04em 0.32em;
260+
}
261+
262+
[data-theme='dark'] .prose :where(mark) {
263+
border-color: hsl(44 100% 64% / 0.52);
264+
background: hsl(44 100% 52% / 0.3);
265+
color: hsl(48 100% 88%);
266+
}
267+
226268
.link-underline {
227269
background-image: linear-gradient(hsl(var(--accent)), hsl(var(--accent)));
228270
background-position: 0 100%;

0 commit comments

Comments
 (0)