DEV Community

Discussion on: Write a function that outputs a pleasant text color hex given a background color hex

Collapse
 
cathodion profile image
Dustin King • Edited

I decided to use machine learning...

14 hours later 😬, here's a work in progress for a script that randomly generates a background color, then generates the foreground color from a neural net that learns from your selections.

Edit:

Converted to codepen by @rhymes :

The gist is still here but I'll take the embed out since gist embeds load slowly and take up a lot of screen real estate.

Edit 2: I cleaned up the code in both places so hopefully it's more readable now. The bulk of the neural stuff happens in regenerateColors() and trainOnCurrentColors().

Collapse
 
rhymes profile image
rhymes

I put it in a Codepen for you:

fork it to your account :-)

Collapse
 
ben profile image
Ben Halpern

Amazing

Collapse
 
booligoosh profile image
Ethan

This would be great if my color choices had any logic to them πŸ˜‚πŸ˜‚πŸ˜‚

No, seriously this is amazing ❀️