Testing

currentColor: Browser Support, Use Cases, Known Issues

currentColor works in Chrome 4+, Edge 12+, Firefox 2+, Safari 4+, Opera 9.5+, Samsung Internet, Android 2.1+, and IE 9+, with global support near 97%.

Author

Prince Dewani

May 6, 2026

currentColor is a CSS keyword that resolves to the computed value of an element's color property and lets you reuse that color on any property that takes a <color>. It works in Chrome 4+, Edge 12+, Firefox 2+, Safari 4+ on macOS and iOS, Opera 9.5+, Samsung Internet, Android Browser 2.1+, and Internet Explorer 9+.

This guide covers what currentColor is, the browsers that support it, where you can use it, how to use it with SVG, and known issues.

What is currentColor?

currentColor is a CSS keyword from the W3C CSS Color Module that always resolves to the computed value of the same element's color property. You can use it as a value for any property that accepts a <color>, including border, background, outline, box-shadow, text-decoration-color, and SVG fill and stroke.

Which browsers does currentColor support?

Every major browser supports currentColor: every Chromium-based browser, Firefox, Safari on macOS and iOS, and Internet Explorer 9 and later, with global support near 97%.

Loading browser compatibility data...

currentColor compatibility in Chrome

Chrome supports currentColor from Chrome 4 on Windows, macOS, Linux, ChromeOS, and Android. Every release since has shipped it on by default with no flag, and the keyword resolves the same way in border, background, box-shadow, text-decoration-color, linear-gradient, and SVG fill and stroke. Chrome 1 to 3 did not support it.

currentColor compatibility in Edge

Microsoft Edge supports currentColor from EdgeHTML 12 onward and on every Chromium-based Edge from Edge 79. The keyword works in border, background, outline, and SVG presentation attributes. EdgeHTML 12 to 18 had a long-standing quirk where currentColor inside linear-gradient resolved to black, which the Chromium-based Edge versions fixed.

currentColor compatibility in Firefox

Firefox supports currentColor from Firefox 2 on every desktop platform and from Firefox for Android 4 on Android. Gecko has shipped it on by default with no flag for the entire time, and it works inside linear-gradient, conic-gradient, accent-color, border, outline, box-shadow, and SVG fill and stroke. Firefox 1 to 1.5 did not support it.

currentColor compatibility in Safari

Safari supports currentColor from Safari 4 on macOS and from Safari 4 on iOS. WebKit applies it in border, background, box-shadow, text-decoration-color, gradient stops, and SVG fill and stroke. Early WebKit had a bug where currentColor inside ::before and ::after content resolved to black; later WebKit releases fixed the issue, so any current iPhone or iPad picks up the inherited color cleanly.

currentColor compatibility in Opera

Opera supports currentColor from Opera 9.5 on Windows, macOS, and Linux, and from Opera Mobile 12 on Android. The Presto-era Opera 9.5 to 12.1 implemented it natively, and every Chromium-based Opera from Opera 15 inherits Chrome's behavior. Opera Mini renders it correctly through its server-rendered pipeline as well.

currentColor compatibility in Samsung Internet

Samsung Internet supports currentColor on every shipping version on Galaxy phones because the browser tracks the Chromium engine that Chrome for Android uses. The keyword resolves identically in border, gradient stops, accent-color, and SVG presentation attributes, so cross-browser code that targets both Chrome and Samsung Internet behaves the same.

currentColor compatibility in Android Browser

Android Browser supports currentColor from Android 2.1 on. Chrome for Android, modern Android WebView, Samsung Internet, and Opera Mobile all expose it, so any device on Android Lollipop or later resolves it correctly in border, background, gradients, and SVG fill. The legacy stock browser on Android 2.1 to 4.4 supports it for color, border, and SVG fill but trips on gradient stops.

currentColor compatibility in Internet Explorer

Internet Explorer supports currentColor from IE 9 through IE 11. IE 5.5 to IE 8 did not support it. IE 10 and IE 11 also resolve currentColor to black inside linear-gradient and radial-gradient, which is a known engine bug. Microsoft has retired Internet Explorer, so production code can drop the IE branch.

Note

Note: currentColor mostly works everywhere, but the gradient and pseudo-element edge cases on legacy Edge, IE 11, and old WebKit still bite. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

Where can you use currentColor in CSS?

currentColor is valid anywhere a CSS <color> type is accepted. That covers most surface-level paint properties on HTML elements and the fill and stroke attributes on SVG.

  • Borders and outlines: Setting border-color: currentColor or outline-color: currentColor makes the border match the text color, so a single color rule restyles both at once.
  • Backgrounds: background-color: currentColor lets a tag like a badge or pill paint its fill from the parent's text color, which is handy for theme-aware components.
  • Box shadows and text shadows: box-shadow and text-shadow accept currentColor, so the glow follows whatever color the element inherits.
  • Gradient stops: linear-gradient, radial-gradient, and conic-gradient stops can use currentColor on Chromium browsers, Firefox, and Safari, which is useful for fade-out masks tied to text color.
  • SVG fill and stroke: Inline SVG icons can use fill="currentColor" or stroke="currentColor" so the icon picks up the link or button color without extra CSS.
  • caret-color and text-decoration-color: Both properties accept currentColor, which keeps the cursor and underline visually tied to the text.
  • accent-color: Chrome and Firefox honor accent-color: currentColor on form controls. Safari does not, so plan for a literal-color fallback.
  • CSS custom properties: You can store currentColor in a custom property like --icon-color: currentColor and reference the variable in nested elements to keep theme rules in one place.

How do you use currentColor with SVG?

Inline SVG inside an HTML page can set fill="currentColor" or stroke="currentColor" on any shape. The SVG element reads the parent HTML element's color property and paints itself with that value, which is why icon libraries lean on the keyword for theme-aware icons.

Paste this snippet into an HTML page and hover the link in DevTools. The icon recolors automatically because both the fill and the stroke point at currentColor.

<!-- Inline SVG inside an anchor inherits the link's color value. -->
<!-- Hover the link in DevTools and watch the icon recolor. -->
<a href="/inbox" style="color: dodgerblue">
  <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
    <path fill="currentColor" d="M2 4h12v8H2z" />
    <path stroke="currentColor" stroke-width="1.5" fill="none" d="M2 4l6 5 6-5" />
  </svg>
  Inbox
</a>

<style>
  a:hover { color: tomato; } /* fill and stroke follow */
  a:focus { color: rebeccapurple; } /* same here */
</style>

The keyword only inherits across the SVG's own document, so an SVG loaded through an <img> tag, a CSS background-image, or an <object> cannot read the host page's color. Inline the SVG, or reference a <symbol> through a <use> tag in the same document, to make fill="currentColor" pick up the parent color.

...

What are the known issues with currentColor?

currentColor is rock-solid on modern browsers, but a handful of legacy quirks and surprising inheritance rules still trip up real codebases.

  • IE 10 and IE 11 gradient bug: Both browsers resolve currentColor to black inside linear-gradient and radial-gradient stops. Use a CSS custom property fallback or a literal color when you support IE.
  • Pre-Chromium Edge gradient bug: EdgeHTML 12 to 18 share the same gradient bug as IE 11. Chromium-based Edge from Edge 79 fixed it.
  • External SVGs do not inherit: SVGs loaded through <img>, background-image, or <object> cannot read the parent page's color. fill="currentColor" silently falls back to black or to the SVG's own default.
  • User-agent button styles override: Native <button> and <input type="submit"> elements ignore currentColor on border-color until you also set color: inherit, because the browser's stylesheet wins.
  • accent-color: currentColor on Safari: Safari ignores accent-color: currentColor on form controls and falls back to the user-agent blue, so checkbox and radio styling drifts on iOS and macOS.
  • Self-reference on color: Setting color: currentColor on the same element triggers the inherited color from the parent, not the element's own. It is a no-op on the root element because there is nothing to inherit from.
  • Animation through currentColor: Animating color animates currentColor for free on every dependent property, but the dependent properties cannot be animated past their currentColor value through @keyframes alone.

In my experience, the trap that bites every icon-library integration once is the external-SVG case. A team inlines a single <img src="icon.svg"> with fill="currentColor" baked in, sees a black icon in production, and chases the bug for an hour. Switch the tag to inline SVG or to a <symbol> with <use> and the color inherits as expected.

...

Citations

All currentColor version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests