lundi 3 avril 2017

How to generate random pastel (or brighter) color in Javascript?

I am building a simple website that gives a random quote when I click a button, and with that, the background color changes. The thing is that sometimes the background color is too dark and the font is black, and consequently the person can't read the quote.

My question is if there is any way to create a random color code using just bright colors, or pastel colors?

I got this code to generate a random color, I tried to edit to get only A to F strings but no success: '#'+((1<<24)*(Math.random()+1)|0).toString(16).substr(1)

Thank you very much in advance.




Aucun commentaire:

Enregistrer un commentaire