
When dark mode swept the internet, designers and developers celebrated. It promised reduced eye strain, battery savings, and a sleek, modern aesthetic. But as millions of websites toggled their stylesheets from light to dark, an unexpected typographic issue emerged: perfectly crisp fonts suddenly looked blurry, bloated, or fuzzy.
If you’ve ever noticed that your white text on a dark gray background looks like it’s glowing or bleeding into the screen, you aren’t imagining things. You’ve fallen into the Dark Mode Typography Trap.
Here is why this happens, the physics behind it, and the CSS rules you need to write to fix it.
To understand why your fonts look different in dark mode, we have to look at how our eyes and screens work.
In the physical world, when you look at a bright light source against a dark background, the light seems to bleed outward. This is called irradiation or halation.
On a digital screen, white pixels emit light, while dark pixels do not. When light text is displayed on a dark background, the glowing subpixels of the white letters bleed into the surrounding dark pixels. To the human eye, this makes the stroke weight of the font look thicker and fuzzier than it actually is.
Operating systems use rendering engines to smooth out the jagged edges of vector fonts. Traditionally, they use subpixel antialiasing (like ClearType on Windows), which manipulates the red, green, and blue components of physical screen pixels.
While subpixel rendering works beautifully for dark text on light backgrounds, it often struggles with light-on-dark text. It creates a subtle "fringe" of color around the letters, which our eyes perceive as a blurry, low-contrast halo.
Fortunately, you don’t need to buy custom fonts to fix this. You can solve these visual bugs using a few precise CSS properties.
For macOS and iOS browsers, you can force the rendering engine to use grayscale antialiasing instead of subpixel antialiasing. This strips away the colorful subpixel fringe, making the letterforms slightly thinner and significantly sharper on dark backgrounds.
/* Apply this specifically when dark mode is active */
[data-theme="dark"] body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Note: Use this property sparingly. It is recommended to apply it specifically to dark mode, as turning off subpixel rendering in light mode can sometimes make light-background text look too thin.
Because the halation effect makes text look bolder, you should dynamically reduce your font weight when switching to dark mode. If you are using a variable font, this is incredibly easy.
/* Light Mode */
body {
font-weight: 400;
}
/* Dark Mode */
@media (prefers-color-scheme: dark) {
body {
font-weight: 375; /* Slightly lighter weight offsets the visual glow */
}
}
If you aren't using variable fonts, you can step down from a standard weight (e.g., 500 to 400) for your body copy in dark mode.
Extreme contrast exacerbates the halation effect. Pure white text (#FFFFFF) on a pitch-black background (#000000) causes the maximum amount of light bleed.
To make your text instantly cleaner and more comfortable to read, soften your color palette. Use an off-white or light gray for your text, and a dark charcoal for your background.
:root {
--bg-color: #121212; /* Off-black */
--text-color: #E0E0E0; /* Soft light gray instead of #FFF */
}
Because characters appear bolder in dark mode, they also look closer together. This decrease in negative space reduces legibility. Adding a micro-dose of letter-spacing (tracking) gives the characters room to breathe.
@media (prefers-color-scheme: dark) {
body {
letter-spacing: 0.01em;
}
h1, h2, h3 {
letter-spacing: -0.01em; /* Headings can remain tight, but body copy needs space */
}
}
Here is a production-ready CSS snippet you can drop into your stylesheet to instantly upgrade your dark mode typography:
/* Global Dark Mode Typography Enhancements */
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #e4e4e7;
/* 1. Force crisp grayscale rendering on Apple devices */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* 2. Counteract halation by opening up letter spacing */
letter-spacing: 0.015em;
}
/* 3. If using a variable font, subtly reduce the weight */
@supports (font-variation-settings: normal) {
body {
font-variation-settings: "wght" 380;
}
}
}
By understanding the optical illusions of the screen, you can craft a dark mode experience that isn't just easy on the eyes, but looks incredibly sharp and professional. Happy styling!
Photo by Leticia Ribeiro on Pexels