faker
faker copied to clipboard
Ability to generate dark and light hex colors with a new optional luminosity option
Currently we can run Faker::Color.hex_color
to generate a random hex color. It does not support any arguments.
It would be great if we could optionally run:
-
Faker::Color.hex_color(luminosity: 'dark')
-
Faker::Color.hex_color(luminosity: 'light')
To simplify the interface this option could default to random
. There's other potential values that could be interesting too like bright
or pastel
but let's not get too crazy from day 1.
If this option existed it would be very easy to generate very nice looking random user avatars. It's common nowadays to generate a random color that is a circle and use the user's first name's initial in place of a photo by default. Darker colors tend to look much better here for that circle and this new feature would let us generate dark colors as needed.
The Python version of Faker has this behavior at https://faker.readthedocs.io/en/master/providers/faker.providers.color.html. I used the word luminosity
based on their documentation as it's pretty much the perfect word to describe what this is.
Currently there's no workaround other than to not use this gem's hex_color generator and instead generate a custom color manually.
I can tackle this feature! :)
hi @adisonlampert how is your work going on the issue? Thanks!
that would be a nice addition. +1 for this!
Came here after seeing your youtube video @thdaraujo and @stefannibrasil 🚀
Came here after seeing your youtube video @thdaraujo and @stefannibrasil 🚀
hooray! welcome, @fbuys !
Welcome @fbuys it's great to see that the live session inspired you to start contributing to Faker :)