Module: FFaker::Color
Instance Method Summary
collapse
const_missing, k, luhn_check, underscore, unique
#fetch_sample, #rand, #shuffle
Instance Method Details
#hex_code ⇒ Object
12
13
14
|
# File 'lib/ffaker/color.rb', line 12
def hex_code
format('%06x', rand * 0xffffff)
end
|
#hsl_array ⇒ Object
32
33
34
|
# File 'lib/ffaker/color.rb', line 32
def hsl_array
[random_hue_value, random_percentage_string, random_percentage_string]
end
|
#hsl_list ⇒ Object
36
37
38
|
# File 'lib/ffaker/color.rb', line 36
def hsl_list
hsl_array.join(',')
end
|
#hsla_array ⇒ Object
40
41
42
|
# File 'lib/ffaker/color.rb', line 40
def hsla_array
hsl_array << random_opacity_value
end
|
#hsla_list ⇒ Object
44
45
46
|
# File 'lib/ffaker/color.rb', line 44
def hsla_list
hsla_array.join(',')
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/ffaker/color.rb', line 8
def name
fetch_sample(NAMES_LIST)
end
|
#rgb_array ⇒ Object
16
17
18
|
# File 'lib/ffaker/color.rb', line 16
def rgb_array
[random_rgb_value, random_rgb_value, random_rgb_value]
end
|
#rgb_list ⇒ Object
20
21
22
|
# File 'lib/ffaker/color.rb', line 20
def rgb_list
rgb_array.join(',')
end
|
#rgba_array ⇒ Object
24
25
26
|
# File 'lib/ffaker/color.rb', line 24
def rgba_array
rgb_array << random_opacity_value
end
|
#rgba_list ⇒ Object
28
29
30
|
# File 'lib/ffaker/color.rb', line 28
def rgba_list
rgba_array.join(',')
end
|