module FFaker::Color
Public Instance Methods
Source
# File lib/ffaker/color.rb, line 12 def hex_code format('%06x', rand * 0xffffff) end
Source
# File lib/ffaker/color.rb, line 32 def hsl_array [random_hue_value, random_percentage_string, random_percentage_string] end
Source
# File lib/ffaker/color.rb, line 40 def hsla_array hsl_array << random_opacity_value end
Source
# File lib/ffaker/color.rb, line 16 def rgb_array [random_rgb_value, random_rgb_value, random_rgb_value] end
Source
# File lib/ffaker/color.rb, line 24 def rgba_array rgb_array << random_opacity_value end
Private Instance Methods
Source
# File lib/ffaker/color.rb, line 58 def random_hue_value rand(0..359) end
Source
# File lib/ffaker/color.rb, line 54 def random_opacity_value rand(0.0..1.0).round(2) end
Source
# File lib/ffaker/color.rb, line 62 def random_percentage_string "#{rand(0..99)}%" end