Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Utilizing Hexadecimal Colors

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?

2 Replies
pljsoftware
Creator III
Creator III

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.

ChristofSchwarz
Partner Ambassador
Partner Ambassador

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 ...