Method: Faker::Color.hex_color
- Defined in:
- lib/faker/default/color.rb
.hex_color(args = nil) ⇒ String
Produces a hex color code. Clients are able to specify the hue, saturation, or lightness of the required color. Alternatively a client can simply specify that they need a light or dark color.
29 30 31 32 33 34 |
# File 'lib/faker/default/color.rb', line 29 def hex_color(args = nil) hsl_hash = {} hsl_hash = { lightness: LIGHTNESS_LOOKUP[args] } if i[dark light].include?(args) hsl_hash = args if args.is_a?(Hash) hsl_to_hex(hsl_color(**hsl_hash)) end |