mattdesl / color-wander

:art: Generative artwork in node/browser based on a seeded random
http://color-wander.surge.sh/
1.62k stars 147 forks source link

How to set the background color to white #17

Closed kevinmamaqi closed 7 years ago

kevinmamaqi commented 7 years ago

Hello,

I would like to set the background-color to white. I think that it is assigned via browser.js file on line 69: document.body.style.background = opts.palette[0];

When I change the value to white, or rgba white the script wont work.

How to change it?

benjaminrbarnes commented 7 years ago

opts.palette is an array of Hex color codes. To change the background to white, just do opts.palette[0] = "#FFFFFF"; right before document.body.style.background = opts.palette[0];. The 0 index is used for the background.

If you assign document.body.style.background to white and not the palette array, when getBestContrast is called, you will not be using white to "get the best contrast"