module FFaker::Color
Public Instance Methods
hex_code()
click to toggle source
# File lib/ffaker/color.rb, line 12 def hex_code format('%06x', rand * 0xffffff) end
hsl_array()
click to toggle source
# File lib/ffaker/color.rb, line 32 def hsl_array [random_hue_value, random_percentage_string, random_percentage_string] end
hsl_list()
click to toggle source
# File lib/ffaker/color.rb, line 36 def hsl_list hsl_array.join(',') end
hsla_array()
click to toggle source
# File lib/ffaker/color.rb, line 40 def hsla_array hsl_array << random_opacity_value end
hsla_list()
click to toggle source
# File lib/ffaker/color.rb, line 44 def hsla_list hsla_array.join(',') end
name()
click to toggle source
# File lib/ffaker/color.rb, line 8 def name fetch_sample(NAMES_LIST) end
rgb_array()
click to toggle source
# File lib/ffaker/color.rb, line 16 def rgb_array [random_rgb_value, random_rgb_value, random_rgb_value] end
rgb_list()
click to toggle source
# File lib/ffaker/color.rb, line 20 def rgb_list rgb_array.join(',') end
rgba_array()
click to toggle source
# File lib/ffaker/color.rb, line 24 def rgba_array rgb_array << random_opacity_value end
rgba_list()
click to toggle source
# File lib/ffaker/color.rb, line 28 def rgba_list rgba_array.join(',') end
Private Instance Methods
random_hue_value()
click to toggle source
# File lib/ffaker/color.rb, line 58 def random_hue_value rand(0..359) end
random_opacity_value()
click to toggle source
# File lib/ffaker/color.rb, line 54 def random_opacity_value rand(0.0..1.0).round(2) end
random_percentage_string()
click to toggle source
# File lib/ffaker/color.rb, line 62 def random_percentage_string "#{rand(0..99)}%" end
random_rgb_value()
click to toggle source
# File lib/ffaker/color.rb, line 50 def random_rgb_value rand 255 end