
You’ve carefully designed a beautiful light-mode interface. The typography is elegant, crisp, and perfectly balanced. But the moment you flip the switch to dark mode, something goes wrong. The exact same font, styled with the exact same CSS font-weight, suddenly looks bloated, heavy, and slightly blurry.
What you are experiencing isn’t a bug in your browser or a mistake in your stylesheet. It is a optical phenomenon known as the irradiation illusion, combined with how digital screens render pixels.
Here is why your typography shifts in dark mode—and how you can fix it using modern CSS.
To understand why text looks thicker on dark backgrounds, we have to look at both human biology and display technology.
Discovered in the 19th century, the irradiation illusion is a physiological quirk of the human eye. Light areas on a dark background appear larger than dark areas of the same size on a light background.
When you look at white text on a black screen, the light emitted from the pixels bleeds into the surrounding dark pixels on your retina. This physical "glow" (or halation) tricks your brain into perceiving the white lines as thicker than they actually are.
Operating systems use subpixel rendering to keep text looking sharp on low-to-medium-resolution screens. On light backgrounds, this technique uses subtle color fringing at the edges of letters to smooth out curves. On dark backgrounds, however, these subpixel anti-aliasing techniques can fail to render cleanly, resulting in a fuzzy, bloated appearance.
Fortunately, you don’t have to accept muddy typography in dark mode. By applying a few subtle CSS adjustments, you can optically match your dark-theme typography to your light-theme baseline.
If you are using variable fonts, you have the ultimate superpower for resolving this issue. Traditional fonts limit you to steps of 100 (e.g., font-weight: 400 vs 300). Variable fonts allow you to adjust the weight to precise integers.
By shaving a tiny fraction off your font-weight in dark mode, you can counteract the irradiation illusion perfectly:
/* Light mode default */
body {
font-family: "YourVariableFont", sans-serif;
font-weight: 400;
color: #1a1a1a;
background-color: #ffffff;
}
/* Dark mode adjustment */
@media (prefers-color-scheme: dark) {
body {
font-weight: 360; /* Optically matches the light mode 400 */
color: #f5f5f5;
background-color: #121212;
}
}
On macOS, browsers render text with a heavier hand by default. You can tell the browser to use a lighter, greyscale-based anti-aliasing method when dark mode is active.
While CSS font-smoothing properties are non-standard, they are widely supported on macOS/iOS engines and work wonders for cleaning up dark mode fuzziness:
@media (prefers-color-scheme: dark) {
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
Note: Keep this utility restricted to dark mode, as removing subpixel rendering in light mode can sometimes make text look too thin and faint.
The higher the contrast, the worse the irradiation effect will be. Writing pure white text (#FFFFFF) on a pure black background (#000000) creates a harsh visual vibration and maximizes the "glow" effect.
To instantly soften your typography and reduce the perceived thickness, dial back the contrast slightly:
#121212 or #1A1A1A) instead of #000000.#E0E0E0 or #F0F0F0) instead of #FFFFFF.:root {
--bg-color: #ffffff;
--text-color: #1c1c1e;
}
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #121212;
--text-color: #e4e4e7; /* 90% white reduces irradiation */
}
}
Because text looks thicker in the dark, the negative space between your letters (counters and tracking) shrinks. This can make tight, compact headings difficult to read.
Compensate for this by adding a tiny touch of positive letter-spacing in your dark mode styles:
h1, h2, h3 {
letter-spacing: -0.02em; /* Tight tracking for light mode */
}
@media (prefers-color-scheme: dark) {
h1, h2, h3 {
letter-spacing: 0.01em; /* Open it up slightly to breathe */
}
}
By combining these techniques, you can build a robust, dark-mode-ready typographic stylesheet that looks consistently elegant across both themes:
/* Base Styles */
body {
background-color: var(--bg);
color: var(--text);
font-family: "Inter", sans-serif;
font-weight: 400;
transition: background-color 0.3s, color 0.3s;
}
/* Light Theme Variables */
:root {
--bg: #ffffff;
--text: #1a1a1a;
}
/* Dark Theme Variables & Typography Fixes */
@media (prefers-color-scheme: dark) {
:root {
--bg: #121212;
--text: #e2e8f0;
}
body {
font-weight: 370; /* Shave weight if using a variable font */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.01em;
}
}
Designing an exceptional user experience is all about sweat-the-small-stuff details. By adjusting your typography to compensate for human biology and screen optics, you ensure your design remains legible, balanced, and premium—no matter what time of day your users are reading.