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,522
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