
Theming SVG Icons with currentColor and Tokens
Inline or sprited single-color icons that paint with currentColor inherit hover, disabled, and dark-mode color for free. Duotone adds a custom-property channel; both point at shared tokens.
TL;DR: An icon becomes themeable the moment it stops carrying its own color. Single-color icons that are inlined or referenced from a sprite with <use> should paint with currentColor, so they inherit the CSS color of the text or control around them — hover, disabled, inverted, and dark-mode color then come for free. Duotone and multi-color icons need one more channel, which CSS custom properties inside the SVG provide. And the values those properties resolve to should be the product's shared semantic color tokens, not a private icon palette. This guide covers the single-color default, the multi-tone technique, the token boundary, and why dark mode stops needing per-icon color work (contrast still needs checking in each theme).
currentColor: the single-color default
currentColor is a CSS keyword that stands for the value of the element's own color property; used on color itself, it takes the inherited value (MDN: currentColor keyword, accessed November 2026). In an SVG, using it for fill or stroke means the shape paints with whatever text color its context has. The icon carries no color of its own; it borrows one.
<!-- Source after normalization: no hardcoded color anywhere -->
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
<path fill="currentColor" d="..."/>
</svg>Placed inside a button, that icon now follows the button. When the button's text turns to the hover color, the icon does too. When the button is disabled and its text dims, the icon dims with it. When the button sits on a dark surface with light text, the icon turns light. None of those states needs an icon-specific rule, because each one already changes color on the container.
This is why currentColor should be the baseline convention for every single-color icon in a set, enforced by the build rather than remembered at the call site. The optimization step that cleans exported SVGs is the natural place to rewrite single-color fills and strokes to currentColor, and to fail the build when an icon arrives with a hardcoded hex value it should not have. A convention that depends on every designer exporting correctly will break; a convention the build applies will hold.
The failure it prevents is easy to recognize in an icon set shipped without it: icons that stay black while everything around them changes. A destructive button turns red and its trash icon stays charcoal. A link changes color on hover and its arrow does not. A dark theme ships and a dozen icons vanish into the background because they were drawn in a dark gray that only made sense on white. Each of these gets "fixed" with a one-off override, and each override is a place where the next theme change will break again.
Outline icons need the same treatment on the other paint property. A stroke-based icon whose stroke is hardcoded ignores its context exactly as a hardcoded fill does, and the fix is the same: stroke="currentColor" with fill="none" on the outline paths. Mixed icons — a filled dot inside an outlined circle, say — use currentColor on both properties, so the two parts can never drift apart. The build should check both properties, not just fills; a normalization step that rewrites fills and leaves strokes alone produces a set where the outline icons quietly stay one color while the filled ones follow the theme. A single test that fails on any non-currentColor paint value outside the documented accent channels catches all of these cases at once.
Two practical details keep the default working. Inline SVG and SVG sprites referenced with <use> inherit color from the page, so currentColor works in both. An SVG loaded as an <img> or a CSS background image is a separate document and does not see the page's CSS at all — currentColor there resolves inside the image, not to your button. That is one of the reasons the delivery choice matters for theming, and why a themeable system should inline or sprite its icons.
Beyond one color: duotone and multi-color icons
currentColor carries exactly one value. A duotone icon — a primary shape plus a lighter accent layer, say a folder outline with a tinted tab — needs a second channel, and the clean channel is a CSS custom property read inside the SVG (MDN: Using CSS custom properties, accessed November 2026). Custom properties inherit through the DOM just as color does, unless one is registered with inherits: false (through @property or CSS.registerProperty()), so an inline or sprited icon can read a variable set by its container.
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
<!-- Accent layer: themeable, with a safe fallback -->
<path style="fill: var(--icon-accent, currentColor)" opacity="0.4" d="..."/>
<!-- Primary layer: follows text color -->
<path fill="currentColor" d="..."/>
</svg>The structure matters more than the syntax. Each layer is a separate path with its own fill, and each fill points at a named channel — currentColor for the primary, --icon-accent for the second tone. The fallback inside var() means the icon still renders sensibly if no container sets the accent: it collapses to a single-color icon instead of turning black or disappearing. Nobody edits the SVG per use; a call site that wants a different accent sets one property on the container.
.status-badge--warning {
color: var(--color-text-warning);
--icon-accent: var(--color-surface-warning);
}When multi-color icons are worth it is a narrower question than design teams sometimes assume. Duotone works well where the second tone carries structure — distinguishing a container from its contents, or a state indicator from its frame — and where the set can agree on one or two accent roles. Full-color illustrative icons fight theming: every hardcoded color is a decision the theme cannot reach, and a dark theme turns them into small framed pictures that no longer match the interface around them.
The rule that keeps multi-tone icons manageable is to keep the accent count low and named. As a working rule, start with one accent channel and treat a second as a ceiling that should require a reason. Name the channels by role in the icon system — primary, accent — and document them beside the set, so the build can check that every multi-tone icon uses only the documented channels and nothing else.
Consuming tokens, not redefining them
The values that color and --icon-accent resolve to are where icon theming joins the rest of the product. An icon on a danger button should be the danger color because it is the danger button's text color — the same semantic token the label uses, not a separate "icon red." An icon on a muted caption should resolve to the same muted-text token as the caption. Icon color is a consumer of the product's color decisions, not a second, private palette of them.
The difference shows up the first time the product is rethemed. With a private icon palette, a brand color change means updating the text tokens and then finding and updating the icon colors that were meant to match them, with a real risk of missing some. With icons pointing at shared semantic tokens, the retheme retints the icons automatically, because there was only ever one decision to change.
The boundary of this treatment is deliberate. How semantic tokens are structured — the tiers, the naming, the build that turns them into CSS variables — belongs to the token system and its own literature. An icon system consumes those tokens at the call site and stops there. In practice that means the icon package itself references no color tokens at all: its SVGs speak only currentColor and the documented accent properties. The component or stylesheet that places the icon maps those channels to semantic tokens. Keeping the package token-free is what lets the same icon set work in two products with two different token systems.
A useful self-check is to search the icon package for color values. If it contains hex codes, named colors, or references to specific color tokens, some decision that belongs to the theme has leaked into the icons.
Dark mode and state without per-icon work
Because icons inherit color, dark mode is a context change rather than an icon change. The theme swaps the values behind the semantic tokens; text changes color; icons change with it. There is no second dark icon set to draw, export, version, and keep in sync with the first — a second set is a standing source of drift.
State works the same way. Hover, active, focus, and disabled styling belongs to the button or link, which changes its own color and, where needed, the accent property. The icon follows. Icon-specific rules such as .button:hover svg path { fill: ... } are a sign the inheritance chain is broken somewhere — for example, a hardcoded fill the build should have caught.
The whole model fits in one illustrative shape: the same icon markup, two themes, no change to the icon.
/* Illustrative shape, not a full theme */
:root {
--color-text-default: #1f2328;
--color-accent-subtle: #b6c8e8;
}
[data-theme="dark"] {
--color-text-default: #e6e8eb;
--color-accent-subtle: #36507a;
}
.toolbar-button {
color: var(--color-text-default);
--icon-accent: var(--color-accent-subtle);
}Toggle the theme attribute and the icon inside every toolbar button repaints — primary layer through currentColor, accent layer through --icon-accent — without touching the SVG, the sprite, or the component that renders it.
The same property makes theme bugs easier to locate. When an icon renders the wrong color in one theme, once the build blocks hardcoded colors, the question shifts from "which icon file is wrong?" to "which container sets the wrong color or accent value?" That narrows the search to stylesheets and tokens, where the theme decisions actually live, instead of a folder of hundreds of SVGs.
There are two edges to watch. Contrast does not come for free: an icon that inherits a token is only as legible as that token is against its background, so meaningful icons still need checking against the non-text contrast requirement in each theme. And icons delivered as images or background images sit outside this model entirely; if a set has to support theming, those delivery routes are the exception to document, not the default to build on.