FontAwesome 5 offers thousands of icons that are built with SVG. This way, it's easy to color the entire icon by using fill
. But what if I want to use multiple colors? For example, given the icon Google, I want to color it like so:
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
By using gradient for the color and two icons we may achieve this but it remains a hacky way and you need to handle each case (icon + coloration) specifically:
We can also consider the use of
conic-gradient()
with one icon. Again, it is specific to this particular case:The above will not work in all the browser so you can consider multiple
linear-gradient
like below:There is no way you can achieve that with FontAwesome (or any other available icon font) without making your hands dirty - that is, modifying the font and creating your own custom HTML and CSS on top of the partial icon characters you created.
Create each icon colored part separately as a character and stack them on top of each other. The example stacks two existing FA-icons to show the technique: