How do icons automatically change color when their parent button changes from resting state to hover state, or switches from light to dark mode?
The secret is the CSS keyword currentColor:
<svg stroke="currentColor" fill="none" ...>
<path d="..." />
</svg>
When stroke="currentColor" or fill="currentColor" is set inside the SVG:
color CSS property is active on its parent container.text-white hover:text-amber-300, the icon turns white and seamlessly transitions to amber on hover with zero extra JavaScript or CSS overrides!Level 4 · Component Architecture & Visual Language