Convert RGB to Hex (decimal to hexadecimal)

Here is an expression to convert a RGB decimal number to a Hexadecimal.
I used it in a color mixer.

The column [Hex #] is a TEXT column with the initial value:

CONCATENATE(
SWITCH(Floor([Red]/16),10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",Floor([Red]/16)),
	SWITCH([Red]-Floor([Red]/16)*16,10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",[Red]-Floor([Red]/16)*16),

SWITCH(Floor([Green]/16),10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",Floor([Green]/16)),
	SWITCH([Green]-Floor([Green]/16)*16,10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",[Green]-Floor([Green]/16)*16),

  SWITCH(Floor([Blue]/16),10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",Floor([Blue]/16)),
	SWITCH([Blue]-Floor([Blue]/16)*16,10,"A",11,"B",12,"C",13,"D",14,"E",15,"F",[Blue]-Floor([Blue]/16)*16)
)
5 Likes

Awesome! Very creative use of the sliders.

1 Like

I love this so much! This community is pushing AppSheet further and further in such creative directions!

2 Likes

I was about to ask the other day… But didn’t lol