Anyone know how to create a random color hex ...

Anyone know how to create a random color hex code? Preferably unique to the tableโ€ฆ

0 12 2,535
12 REPLIES 12

tony1
New Member

@Grant_Stead I think this will work in excel/sheets:

=DEC2HEX(RANDBETWEEN(0, 256^3), 6)

Might be a good starting place.

@Grant_Stead How are you using random colors?

In case anyone stumbles on this, hereโ€™s what I did. Iโ€™ve got appsheet dropping in an initial RANDBETWEEN(0, 16777215) so that it stays fixedโ€ฆ Then Iโ€™ve got an array formula on the google sheets side to convert it to HEX color code. =ARRAYFORMULA(IF(ROW(AN1:AN)=1,โ€œpeople_hex_colorโ€, IF(ISBLANK(AN1:AN),DEC2HEX(AN1:AN, 6))))

@tony @Grant_Stead Should be: =DEC2HEX(RANDBETWEEN(0, 256^3 - 1), 6) Since =DEC2HEX(256^3, 6) is invalid (extremely unlikely to happen)

@Gil_Littman_AppSheet is there an option on the appsheet side?

@Grant_Stead Not as far as I know.

@Stephen_Mattison So, long story short. With thisโ€ฆ imgplaceholder.com - ImgPlaceholder.com

I can make custom icons, by building a concatenated URL. This also gives me the ability to have unique colors for each person, that way if they make comments, etc. You can tell whom it is at a glance. ImgPlaceholder.com imgplaceholder.com

@Grant_Stead Nice work, me likey! TY!

@Gil_Littman_AppSheet Why the -1?

@Gil_Littman_AppSheet Nevermindโ€ฆ I get it LOLโ€ฆ 256 of each red/green/blueโ€ฆ starting at 0 not 1โ€ฆ bang.

@Grant_Stead How about
"https://ui-avatars.com/api/?background=" & RANDBETWEEN(000000,999999) & "&name=" & ENCODEURL([UserName])

Top Labels in this Space