Skip to content

chrisschnaars/color-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color Generator

Perhaps the easiest way to find your next favorite color.

How to Use

Find a color is easy. For those of you on traditional computers and laptops, press spacebar to generate a random color. If you're using a touch device, you can simply tap your screen.

If you go too fast, and pass by a color that may have been a keeper, simply use your back key to view previously generated colors. Use the forward key to go the other direction.

Notes of Potential Interest

The text color is determined by calculating the WCAG contrast ratio of the randomly-generated color against both black and white, and choosing whichever ratio is higher (more contrast).

Both ratios are compared to see if they meet the minimum contrast ratio of 4.5.

It would be great to not only compare these two pre-determined colors, but instead generate a text color that has an even more ideal ratio (somewhere over 7 for smaller text).