Skip to content

Commit 1d765ec

Browse files
committed
Readable yellow highlights in dark mode
Light text on the yellow marker was unreadable in the dark theme: the marker becomes a full block with ink text there (like the JS logo), bounded to the glyphs so tight display line-heights do not bleed over the line above. Links that turn yellow on hover now switch to ink.
1 parent 14b118b commit 1d765ec

4 files changed

Lines changed: 24 additions & 11 deletions

File tree

‎inertia/css/app.css‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
--ok: #0b7a53;
2727
--danger: #b4152b;
2828
--grain-opacity: 0.05;
29+
--mark-height: 0.42em;
30+
--mark-position: 0 88%;
31+
--mark-color: inherit;
32+
--mark-padding: 0.04em;
2933
color-scheme: light;
3034
}
3135

@@ -43,6 +47,12 @@
4347
--ok: #45c08c;
4448
--danger: #ff6b6b;
4549
--grain-opacity: 0.035;
50+
/* Cap height to descender, not the whole content box: tight display
51+
line-heights would otherwise let the block bleed over the line above. */
52+
--mark-height: 0.96em;
53+
--mark-position: 0 80%;
54+
--mark-color: var(--js-ink);
55+
--mark-padding: 0.08em;
4656
color-scheme: dark;
4757
}
4858

@@ -166,14 +176,17 @@
166176
padding-inline: clamp(16px, 4vw, 40px);
167177
}
168178

169-
/* Highlighter: the JS-yellow marker sweeps under the text. */
179+
/* Highlighter: the JS-yellow marker sweeps under the text.
180+
Light theme: a half-height band under dark ink. Dark theme: the text is
181+
light, so the marker becomes a full block with ink text (like the JS
182+
logo) — light text on yellow would be unreadable. */
170183
@utility mark {
171184
background-image: linear-gradient(var(--js), var(--js));
172185
background-repeat: no-repeat;
173-
background-position: 0 88%;
174-
background-size: 100% 0.42em;
175-
color: inherit;
176-
padding-inline: 0.04em;
186+
background-position: var(--mark-position);
187+
background-size: 100% var(--mark-height);
188+
color: var(--mark-color);
189+
padding-inline: var(--mark-padding);
177190
-webkit-box-decoration-break: clone;
178191
box-decoration-break: clone;
179192
}
@@ -226,10 +239,10 @@
226239

227240
@keyframes mark-sweep {
228241
from {
229-
background-size: 0% 0.42em;
242+
background-size: 0% var(--mark-height);
230243
}
231244
to {
232-
background-size: 100% 0.42em;
245+
background-size: 100% var(--mark-height);
233246
}
234247
}
235248

‎inertia/pages/auth/login.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function Login({ redirect }: { redirect: string }) {
8484
Pas encore membre ?{' '}
8585
<Link
8686
href="/register"
87-
className="font-semibold text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js"
87+
className="font-semibold text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js hover:text-js-ink"
8888
>
8989
Créer un compte
9090
</Link>

‎inertia/pages/auth/register.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default function Register() {
136136
Déjà membre ?{' '}
137137
<Link
138138
href="/login"
139-
className="font-semibold text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js"
139+
className="font-semibold text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js hover:text-js-ink"
140140
>
141141
Se connecter
142142
</Link>

‎inertia/pages/pages/about.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function About() {
4848
tout l’écosystème ont leur place. Le site s’inspire de{' '}
4949
<a
5050
href="https://laravel.cm"
51-
className="font-medium text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js"
51+
className="font-medium text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js hover:text-js-ink"
5252
target="_blank"
5353
rel="noopener noreferrer"
5454
>
@@ -90,7 +90,7 @@ export default function About() {
9090
à{' '}
9191
<a
9292
href="mailto:support@javascript.cm"
93-
className="font-medium text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js"
93+
className="font-medium text-ink underline decoration-js decoration-2 underline-offset-4 hover:bg-js hover:text-js-ink"
9494
>
9595
support@javascript.cm
9696
</a>

0 commit comments

Comments
 (0)