Generate nice random colors
source link: https://gist.github.com/bendc/76c48ce53299e6078a76
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Instantly share code, notes, and snippets.
Author
bendc commented on Jan 26, 2015
Generating random colors by just using Math.random
values often results in dark and unattractive colors. The randomColor
function applies some restrictions in order to return more vibrant and appealing colors.
An example of use can be seen on this demo.
Thank you !
This is really nice!
Thank you :D
First of all, thanks for the function. I'm trying it in Dart (Flutter), in this CodePen.
Generating random colors by just using
Math.random
values often results in dark and unattractive colors. TherandomColor
function applies some restrictions in order to return more vibrant and appealing colors.
Just curious, the values of the restrictions (42, 98, etc.) - how did you select them?
An example of use can be seen on this demo.
The url of the demo no longer works.
Author
bendc commented 3 days ago
First of all, thanks for the function. I'm trying it in Dart (Flutter), in this CodePen.
Generating random colors by just using
Math.random
values often results in dark and unattractive colors. TherandomColor
function applies some restrictions in order to return more vibrant and appealing colors.Just curious, the values of the restrictions (42, 98, etc.) - how did you select them?
I eyeballed them -- feel free to tweak them!
An example of use can be seen on this demo.
The url of the demo no longer works.
Here you are :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK