loading...

Discussion on: Generate and Set Pseudorandom Hexadecimal Background Color Using JavaScript

Collapse
darkain profile image
Vincent Milum Jr

Have you considered using .toString(16)? Also, what about just using actual CSS integer RGB values instead of hex? Seems like either could simplify this. :)

Collapse
craigmc08 profile image
Craig McIlwrath

toString(16) has the problem of numbers like 14 ending up being one character long, so you need a left pad function. rgb color values are the best solution, imo (or hsl)