class Faker::Color

Public Class Methods

alpha_channel() click to toggle source
# File lib/faker/color.rb, line 26
def alpha_channel
  @alpha_channel = rand
  @alpha_channel
end
hex_color() click to toggle source
# File lib/faker/color.rb, line 4
def hex_color
  @hex_color = "#%06x" % (rand * 0xffffff)
end
hsl_color() click to toggle source
# File lib/faker/color.rb, line 31
def hsl_color
  @hsl_colors = []
  3.times do
    @hsl_colors.push single_hsl_color
  end
  @hsl_colors
end
hsla_color() click to toggle source
# File lib/faker/color.rb, line 39
def hsla_color
  @hsla_colors = []
  3.times do
    @hsla_colors.push single_hsl_color
  end
  @hsla_colors.push alpha_channel
  @hsla_colors
end
rgb_color() click to toggle source
# File lib/faker/color.rb, line 13
def rgb_color
  @rgb_colors = []
  3.times do
    @rgb_colors.push single_rgb_color
  end
  @rgb_colors
end
single_hsl_color() click to toggle source
# File lib/faker/color.rb, line 21
def single_hsl_color
  @single_hsla_color = Faker::Base::rand_in_range(0.0, 360.00).round(2)
  @single_hsla_color
end
single_rgb_color() click to toggle source
# File lib/faker/color.rb, line 8
def single_rgb_color
  @single_rgb_color = (0..255).to_a.sample
  @single_rgb_color
end