Module: FFaker::Color

Extended by:
Color, ModuleUtils
Included in:
Color
Defined in:
lib/ffaker/color.rb

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#hex_codeObject


12
13
14
# File 'lib/ffaker/color.rb', line 12

def hex_code
  format('%06x', rand * 0xffffff)
end

#hsl_arrayObject


32
33
34
# File 'lib/ffaker/color.rb', line 32

def hsl_array
  [random_hue_value, random_percentage_string, random_percentage_string]
end

#hsl_listObject


36
37
38
# File 'lib/ffaker/color.rb', line 36

def hsl_list
  hsl_array.join(',')
end

#hsla_arrayObject


40
41
42
# File 'lib/ffaker/color.rb', line 40

def hsla_array
  hsl_array << random_opacity_value
end

#hsla_listObject


44
45
46
# File 'lib/ffaker/color.rb', line 44

def hsla_list
  hsla_array.join(',')
end

#nameObject


8
9
10
# File 'lib/ffaker/color.rb', line 8

def name
  fetch_sample(NAMES_LIST)
end

#rgb_arrayObject


16
17
18
# File 'lib/ffaker/color.rb', line 16

def rgb_array
  [random_rgb_value, random_rgb_value, random_rgb_value]
end

#rgb_listObject


20
21
22
# File 'lib/ffaker/color.rb', line 20

def rgb_list
  rgb_array.join(',')
end

#rgba_arrayObject


24
25
26
# File 'lib/ffaker/color.rb', line 24

def rgba_array
  rgb_array << random_opacity_value
end

#rgba_listObject


28
29
30
# File 'lib/ffaker/color.rb', line 28

def rgba_list
  rgba_array.join(',')
end