Dev Helpers
← Back

Set an SVG stroke from the text colour

Set an SVG stroke 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: none;
    stroke: currentColor;
    stroke-width: 4;
  }
  .demo {
    color: #6d28d9;
  }
</style>
<div class="demo">
  <svg aria-hidden="true" width="64" height="42">
    <circle cx="20" cy="20" r="16" />
  </svg>
  SVG outline follows text
</div>