
Dark mode is no longer a luxury or a trendy toggle; it is a core user preference. Users expect a seamless transition from light to dark interfaces, especially in low-light environments.
However, many designers and developers make a fundamental mistake when building dark mode interfaces: they simply invert their color palette and call it a day.
When you display light text on a dark background, a optical illusion occurs that degrades readability and causes eye strain. To create a truly premium dark mode user interface, you must adapt your typography. Here is how to master the "dark side" of type.
To understand why simple color inversion fails, we have to look at physics and human biology. This visual anomaly is known as irradiation (or halation).
When light text is set against a dark background, the light emitting from the screen bleeds into the surrounding dark pixels. To the human eye, this makes the white letters appear bolder, thicker, and fuzzier than they actually are. Conversely, dark text on a light background absorbs light, making the characters feel crisper and thinner.
If you keep the exact same font weight, line height, and letter-spacing in both light and dark modes, your dark mode copy will look cramped, overly bold, and highly fatiguing to read over long periods.
To counteract irradiation and deliver a comfortable reading experience, implement these four typographic adjustments.
Because light text on dark backgrounds glows and expands, you should slightly decrease the weight of your body copy and headings in dark mode.
If your light mode uses a Regular (400) weight for body copy, consider dropping it to a Light (300) weight in dark mode. If you are using variable fonts, you have even finer control and can shave off 30 to 50 weight units.
Since characters appear thicker in dark mode, the negative space inside and between the letters shrinks. To prevent characters from blending together, slightly increase your letter-spacing.
Adding a tiny amount of tracking (e.g., 0.01em to 0.03em) lets the letters breathe and keeps your text sharp and legible.
Maximum contrast is actually the enemy of readability in dark mode. Placing pure white text (#FFFFFF) on a pitch-black background (#000000) creates harsh high-contrast vibrations that cause immediate eye fatigue, known as "halation blooming."
Instead, soften the contrast:
#E2E8F0 or #F1F5F9).#0F172A or #121212).To compensate for the visual weight of glowing text, give your lines of text more room to breathe. Increasing your line-height by a small percentage (e.g., from 1.5 to 1.55 or 1.6) prevents the glowing text on one line from bleeding into the line below it.
With modern CSS, implementing these typographic micro-adjustments is highly straightforward. If you use Variable Fonts, you can dynamically adjust the font-weight axes dynamically using CSS Custom Properties.
Here is a practical example of how to implement these dark mode adjustments cleanly using standard CSS:
/* Base Light Mode Styles */
:root {
--bg-color: #ffffff;
--text-color: #1e293b; /* Deep Slate Gray */
--font-weight-body: 400;
--letter-spacing-body: normal;
--line-height-body: 1.5;
}
/* Dark Mode Overrides */
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #0f172a; /* Deep Navy Gray */
--text-color: #f1f5f9; /* Warm Off-White */
/* Typographic adjustments to fight irradiation */
--font-weight-body: 350; /* Slightly thinner (Variable Font required) */
--letter-spacing-body: 0.02em; /* Added breathing room */
--line-height-body: 1.55; /* Slightly increased leading */
}
}
/* Applying properties to typography */
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: 'Inter Variable', sans-serif;
font-weight: var(--font-weight-body);
letter-spacing: var(--letter-spacing-body);
line-height: var(--line-height-body);
transition: background-color 0.3s ease, color 0.3s ease;
}
If you are not using a variable font, you can toggle between standard font weights like this:
@media (prefers-color-scheme: dark) {
body {
font-weight: 300; /* Fallback to Light if 400 is too heavy */
letter-spacing: 0.015em;
}
}
Great typography is invisible; it allows users to absorb information effortlessly. In dark mode, invisibility requires intentional design compensation. By softening your contrast, loosening your tracking, lowering your font weights, and widening your line heights, you can design a dark mode interface that is as functional and comfortable as it is beautiful.
Take a look at your current project in dark mode. Does the text glow too brightly? Do the paragraphs look dense? A few minor CSS tweaks can completely transform your user experience from eye-straining to eye-pleasing.
Photo by Paras Katwal on Pexels