How to change to a specific color by its hex code in GIMP?

I have a simple black vector icon, and I want to change its color to an other color. I have this other color in hex.

I can use colorize but I can't achieve this color I have in hex.

How can I do it in GIMP?


Sounds like you have not a black icon but a grayscale icon. If your icon is nothing but black, gray (edges), and white background, then you can colorize it quite simply. First, convert your hex color to HSL color. Second, choose the Colorize tool and plug in your H, S, and L.

Converting from hex color to HSL color is pretty straightforward arithmetic but it is even easier to use an online converter (for example, http://serennu.com/colour/hsltorgb.php). Just be careful not to convert to HSV by mistake, because that is a different color system with a very similar name.

For example: Puce #cc8899 converts to H=345°, S=40%, L=67%. Plug 345, 40, and 67 into Colorize.


In gimp, click on the foreground color box in the toolbox to bring up the Change Foreground Color dialog. In this dialog, enter your hex value in the box to the right of the label HTML_notation and click OK. That will change the foreground color to your hex value.

Use the bucket fill tool to change the black portions of your icon to the foreground color.

Icon files can have multiple layers with different resolutions. Be sure you are editing a visible layer. You will have to change all layers (or just edit the highest resolution and then recreate the other layers using this method.)