class Faker::Color
Public Class Methods
color_name()
click to toggle source
# File lib/faker/color.rb, line 8 def color_name fetch('color.name') end
hex_color()
click to toggle source
# File lib/faker/color.rb, line 4 def hex_color format('#%06x', (rand * 0xffffff)) end
hsl_color()
click to toggle source
returns [hue, saturation, lightness]
# File lib/faker/color.rb, line 21 def hsl_color [sample((0..360).to_a), rand.round(2), rand.round(2)] end
hsla_color()
click to toggle source
# File lib/faker/color.rb, line 25 def hsla_color hsl_color << rand.round(1) end
rgb_color()
click to toggle source
# File lib/faker/color.rb, line 16 def rgb_color Array.new(3) { single_rgb_color } end
single_rgb_color()
click to toggle source
# File lib/faker/color.rb, line 12 def single_rgb_color sample((0..255).to_a) end