Icon: Reconsider color API for standard SVG icons #40102
Labels
[Package] Components
/packages/components
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
The most common use of the
Icon
component involves the standard SVG WordPress icons or similar single-color SVG icons. Currently, there is no official API to control the color of the SVG fill.This often leads to subtle differences in blacks (e.g. if the SVG fill is by default
#000000
and the text color is a slightly lighter black). Or, it requires ad hoc CSS to override the fill color.What is your proposed solution?
Add a
fillColor
prop that defaults tocurrentColor
so most cases will just match the surrounding text color automatically.The tricky part about this is backwards compatibility, and also the fact that
Icon
technically accepts things that are not SVGs. We'll need to decide what the best strategy is, whether that be deprecation or adding a new component that's specific to single-color SVG icons.The text was updated successfully, but these errors were encountered: