Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have been given a list of colors to use in a document that I am working on. All of the colors I have been given are in hexadecimal format. I know that I can use the RGB() function to represent colors, but I'm hoping to avoid having to convert all of the colors from hex to RGB. Is there a way to utilize the hex values I've been given or will I need to convert everything?
Hi,
I think no. If you want to use the hexadecimal color you can write a function to convert you color in rgb when you load your data an after use the rgb color.
Use the following function to convert your 6-digit hexcode. Note that you need to define the variable "vHexDigits", too.
SET vHexDigits = ['1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];
LOAD
RGB(
16 * Match(Upper(Mid(HexColor,1,1)), $(vHexDigits))
+ Match(Upper(Mid(HexColor,2,1)), $(vHexDigits)),
16 * Match(Upper(Mid(HexColor,3,1)), $(vHexDigits))
+ Match(Upper(Mid(HexColor,4,1)), $(vHexDigits)),
16 * Match(Upper(Mid(HexColor,5,1)), $(vHexDigits))
+ Match(Upper(Mid(HexColor,6,1)), $(vHexDigits))
) AS RGBColor
FROM ??? ;
Regards ...