Change the text color of a toolbar. Should its pencil and printer icons change too?
In the IconVectors 2.30 demo below, six buttons use symbols from one SVG file. New, Cut, Undo, and Redo follow the toolbar's text color. Edit stays lavender and Print stays mint. The difference is in the paint values inside the symbols.
The two accent colors are set at 0:35 and 0:45. At 0:58, you can see all six icons together in the browser.
Give each symbol its own color behavior
Here's a three-icon example you can save as document-toolbar.svg. The outlines use stroke. The same choice between currentColor and an explicit color applies to filled shapes via fill.
<svg xmlns="http://www.w3.org/2000/svg"> <symbol id="document" viewBox="0 0 24 24"> <path d="M6 3h8l4 4v14H6z M14 3v5h4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/> </symbol> <symbol id="tool-pencil" viewBox="0 0 24 24"> <path d="m4 20 4.5-1 11-11a2.1 2.1 0 0 0-3-3l-11 11z" fill="none" stroke="#b899ff" stroke-width="2" stroke-linejoin="round"/> </symbol> <symbol id="printer" viewBox="0 0 24 24"> <path d="M6 8V3h12v5 M6 16H3V8h18v8h-3 M6 13h12v8H6z" fill="none" stroke="#51e0c1" stroke-width="2" stroke-linejoin="round"/> </symbol> </svg> Change one CSS value and compare
Save this as toolbar.html beside the sprite. Each button picks its symbol by ID. The visible label names the button, so its SVG can be hidden from assistive technology.
<!doctype html> <html lang="en"> <meta charset="utf-8"> <title>SVG sprite color demo</title> <style> body { background: #101827; } .toolbar { color: #e2e8f0; } .toolbar button { color: inherit; background: #1e293b; border: 1px solid #475569; padding: .5rem; } .toolbar svg { vertical-align: middle; } </style> <div class="toolbar" role="group" aria-label="Document actions"> <button type="button"> <svg width="24" height="24" aria-hidden="true"> <use href="./document-toolbar.svg#document"></use> </svg> New </button> <button type="button"> <svg width="24" height="24" aria-hidden="true"> <use href="./document-toolbar.svg#tool-pencil"></use> </svg> Edit </button> <button type="button"> <svg width="24" height="24" aria-hidden="true"> <use href="./document-toolbar.svg#printer"></use> </svg> Print </button> </div> </html> Run python -m http.server 8000 from that folder and open http://localhost:8000/toolbar.html. Change .toolbar { color: #e2e8f0; } to .toolbar { color: #fbbf24; }, save, and refresh. The three labels and the New icon turn amber. The pencil and printer keep their original colors.
That test makes the choice easy to review in the sprite source. Use currentColor where the icon should follow its button text. Set an explicit stroke or fill where you want the same accent across themes, and check its contrast on each background you ship.
More IconVectors videos
We've opened the Axialis YouTube channel for short demos of SVG workflows. The IconVectors video gallery brings them together, including pixel alignment at 16 px and inline SVG editing in VS Code.