This is going to be a short post, but I wanted to show you how easy it is to have the color scheme for your website be generated randomly on the client-side. It’s a pretty interesting experience for the user, but I don’t think it makes sense for most websites, as most businesses (and even individuals) would want to stick to a more standard color scheme so they can stay consistent with their brand identity. However, if you find something cool to do with these accessible combos do share it with me I would love to see!
Now let’s get to the actual code. There are a few ways to do this, I recently found a tiny (less than 2kb) npm package called colors2k that offers this functionality but I also wanted to show you it’s possible to do this using only vanilla JS, so let’s start with the easy way first. For all these examples I’m using a regular HTML page being bundled using parcel and also pulling in a modified version of grotesk for basic styling.

#webdev #javascript #design #web-design

Generating Accessible Color Combinations For the Web
1.50 GEEK