Lesson 15 of 30
'Invert the colors' is the version of dark mode that ships broken. Real theming is the semantic-token layer from the tokens lesson, applied to a specific, genuinely harder case: elevation, shadows, and brand assets stop working the way they did in light mode.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A raised card uses a soft dark shadow to communicate elevation in light mode. The same shadow technique is reused unchanged in dark mode, and the card no longer looks raised. Why does this happen, and what's the conventional fix?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
The naive version of dark mode is "swap light backgrounds for dark ones and dark text for light text" — and it's exactly the naive version that produces a theme that ships with real, visible bugs. Real theming is the semantic token layer from the design-tokens lesson, doing its actual job: components reference roles (--color-bg, --color-surface, --color-text, --color-border), and the theme decides what value each role resolves to. A component built correctly never says "make this dark" — it says "use the background role," and the active theme decides what that currently means.
Two things break specifically in dark mode that don't in light mode, which is why "invert the colors" undersells the actual work:
This platform's own token system (from the design-tokens lesson) is a real instance of this: --color-bg, --color-surface, --color-surface-raised, and --color-fg are semantic roles, and the light and dark theme definitions each supply their own independently-tuned values for every one of them — not a single value run through an automatic inversion filter.
:root {
--color-bg: var(--p-neutral-50);
--color-surface-raised: var(--p-neutral-0); /* lighter than bg → elevation via shadow works */
}
:root[data-theme="dark"] {
--color-bg: var(--p-neutral-950);
--color-surface-raised: var(--p-neutral-850); /* lighter than bg, not darker — elevation via fill, not shadow */
}
filter: invert(1)) is not real dark theming. It technically flips lightness, but it also inverts hues, breaks images and icons that were never meant to be inverted, and gives no way to independently tune any one role — it's the "swap colors" anti-pattern automated, not solved."How would you implement dark mode?" separates a candidate who says "swap the CSS variables" (true but incomplete) from one who names elevation and asset handling as the parts that actually take real design work — and can explain why a shadow-based elevation technique specifically breaks on a dark background instead of just asserting that it does.