class Faker::Color

def color_name

Returns:
  • (String) -
def color_name
  fetch('color.name')
end

def hex_color

Returns:
  • (String) -
def hex_color
  format('#%06x', (rand * 0xffffff))
end

def hsl_color

Returns:
  • (Array(Float, Float, Float)) -
def hsl_color
  [sample((0..360).to_a), rand.round(2), rand.round(2)]
end

def hsla_color

Returns:
  • (Array(Float, Float, Float, Float)) -
def hsla_color
  hsl_color << rand.round(1)
end

def rgb_color

Returns:
  • (Array(Integer, Integer, Integer)) -
def rgb_color
  Array.new(3) { single_rgb_color }
end

def single_rgb_color

Other tags:
    Private: -
def single_rgb_color
  sample((0..255).to_a)
end