Color Value To Hexadecimal

A simple utility class that will help you convert a color value (from numbers) to hexadecimal color value.

Basically you can convert the color value to hex string with colorNumber.toString(16);
Now, if you have this shade of blue “13311”, for example, it will be converted to “33ff”.

You can fix that with while(hexColor.length < 6) and add “0” to in front of the hex color output.

Read more