> ## Content Index
> Fetch the complete content index at: https://blog.ntag.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Coloring Font Awesome
- URL: https://blog.ntag.fr/react-fontawesome-colored/
- Published: 2018-11-10T20:46:05.000Z
- Updated: 2026-07-17T00:27:20.000Z
- Author: Basile Bruneau
- Tags: Projects, #Import 2024-12-31 13:59, #Import 2026-10-10 15:13

I love [Font Awesome](https://fontawesome.com/?ref=blog.ntag.fr), and have been using it in many projects. With [React Font Awesome](https://fontawesome.com/how-to-use/on-the-web/using-with/react?ref=blog.ntag.fr), it's super easy to use the icons in a React application, and to color them using CSS (they take the color of the text using `currentColor`).

However, some icons are composed of multiple pieces, and it could be interesting to be able to give them different colors, to precise the message, and increase the number of different meanings a single icon can have.

![sun-cloud-rain icon by FontAwesome](https://blog.ntag.fr/content/images/2018/11/sun-fa.png)

Unfortunately, SVGs provided by Font Awesome aren't composed by multiple `<path>` elements, but by a single `<path>` element with all parts in the `d` attribute.

I achieved to split this single path into multiple `<path>`, by detecting those which work together, and re-computing the positions of the sub-parts. That way it's then possible to change the color of each part.

The result of that is a [React component](https://github.com/NTag/react-fontawesome?ref=blog.ntag.fr) in a npm package, allowing you to color each individual part of an icon:

```js
import FontAwesomeIcon from '@ntag/react-fontawesome';

export default () => (
  <FontAwesomeIcon icon="cloud-sun" fill={['#3C6997', '#EDFF71', '#F1DB4B']} />
);

```

[https://github.com/NTag/react-fontawesome](https://github.com/NTag/react-fontawesome?ref=blog.ntag.fr) 

![sun-cloud-rain icon colored](https://blog.ntag.fr/content/images/2018/11/sun-cloud-fa-colored.png)