WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.48k stars 4.18k forks source link

Icon: Reconsider color API for standard SVG icons #40102

Open mirka opened 2 years ago

mirka commented 2 years ago

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 to currentColor 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.

github-actions[bot] commented 2 years ago

Hi, This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.