An icon's <use>
element will inherit the color of the closest parent with a color applied.
You can apply a color helper directly to the <svg>
element.
<svg class="icon text-primary" viewBox="0 0 256 256">
<use xlink:href="/assets/svgs/icons.svg#calendar"></use>
</svg>
Here the color is applied to the parent element and the icon inherits it.
<div class="text-primary">
<svg class="icon" viewBox="0 0 256 256">
<use xlink:href="/assets/svgs/icons.svg#calendar"></use>
</svg>
</div>
Notice that if the component in which the icon is placed has an color applied, the icon will also inherit that color.
<div class="alert alert-info">
<svg class="icon" viewBox="0 0 256 256">
<use xlink:href="/assets/svgs/icons.svg#calendar"></use>
</svg>
</div>