Why light-on-dark text needs optical correction
White text on a black background is almost always harder to read than black text on white. The effect is visible even with a typeface like Yanone Kaffeesatz from Google Fonts: rendered at the same font-weight of 400, the light-on-dark section reads as visibly heavier than its dark-on-light counterpart. This is a matter of how our eyes perceive shapes and colour rather than a CSS error, and reading light text on dark backgrounds stays harder regardless. Without care in a dark-mode context, the text can even seem to vibrate while being read.
Counteracting weight with variable fonts
Variable fonts let us compensate directly: when dark mode is active, a lighter weight makes the text easier to read.
body {
font-weight: 400;
}
@media (prefers-color-scheme: dark) {
body {
font-weight: 350;
}
}
The result is a better balance between the two variants. The difference is small, but it belongs to the class of micro adjustments good design is built from — and if a project already ships variable fonts with all those weights loaded, adjusting the dark-mode text is worth doing.
Longer paragraphs show the same illusion
The perception gap is easier to spot across longer text. With Literata, the light-on-dark column feels bolder although both examples sit at font-weight: 500 — an optical illusion. The same correction applies:
body {
font-weight: 500;
}
@media (prefers-color-scheme: dark) {
body {
font-weight: 400;
}
}
At these sizes, every typographic improvement contributes to the reading experience.
Google Fonts embedding and weight ranges
Google Fonts fonts are typically added with a <link> in the document <head>:
<head>
<link href="https://fonts.googleapis.com/css2?family=Rosario:wght@515&display=swap" rel="stylesheet">
</head>
Here the Rosario typeface is requested at a weight of 515, expressed as wght@515. Even for a variable font, only that single weight is downloaded. Attempting the following, however, fails outright :
body {
font-weight: 400;
}
Nothing happens and the font doesn't load at all. The fix is to declare the desired range explicitly:
<link href="https://fonts.googleapis.com/css2?family=Yanone+Kaffeesatz:[email protected]&display=swap" rel="stylesheet">
@300..500 tells Google Fonts to download a font file containing every weight in that span. Using a ; between weights instead downloads only those weights, so any weight in between — 301, say — cannot be selected:
<link href="https://fonts.googleapis.com/css2?family=Yanone+Kaffeesatz:wght@300;500&display=swap" rel="stylesheet">
The silent failure is easy to lose time on, so better clarity in the embed code — perhaps an option or toggle to pick either a range or specific weights — would help. In any case, variable fonts earn their place here: they allow text adjustments that weren't previously possible.



