Dev Helpers
← Back

Set an SVG fill from the text colour

Set an SVG fill from the text colour with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo svg {
    fill: currentColor;
  }
  .demo {
    color: #0f766e;
  }
</style>
<div class="demo">
  <svg aria-hidden="true" width="64" height="42">
    <circle cx="20" cy="20" r="16" />
  </svg>
  SVG fill follows text
</div>