JavaScript color picker two ways

trying to implement some functionality to learn JS. here is a simple (fixed set array) and hex color picker using a for loop to make it infinite select. ways to improve or add complexity to the project?

link to github folder
live code: color picker (JS)


In your at main · misathemeb/ · GitHub, instead of using an array with characters, you can simply generate three random numbers from 0 to 255 inclusive, convert to hexadecimal format with Number.toString() and concatenate. This is an easier way.

Or, even simpler, generate a single number between 0 and 16777215 (FFFFFF in hex) and pad it with leading zeros up to six characters.

Additional resources:

1 Like