Class: Faker::Color
Constant Summary
Constants inherited
from Base
Base::Letters, Base::Numbers, Base::ULetters
Class Method Summary
collapse
Methods inherited from Base
bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate, with_locale
Class Method Details
.alpha_channel ⇒ Object
30
31
32
33
|
# File 'lib/faker/color.rb', line 30
def alpha_channel
@alpha_channel = rand
@alpha_channel
end
|
.color_name ⇒ Object
8
9
10
|
# File 'lib/faker/color.rb', line 8
def color_name
fetch('color.name')
end
|
.hex_color ⇒ Object
4
5
6
|
# File 'lib/faker/color.rb', line 4
def hex_color
@hex_color = "#%06x" % (rand * 0xffffff)
end
|
.hsl_color ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/faker/color.rb', line 35
def hsl_color
@hsl_colors = []
3.times do
@hsl_colors.push single_hsl_color
end
@hsl_colors
end
|
.hsla_color ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/faker/color.rb', line 43
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 ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/faker/color.rb', line 17
def rgb_color
@rgb_colors = []
3.times do
@rgb_colors.push single_rgb_color
end
@rgb_colors
end
|
.single_hsl_color ⇒ Object
25
26
27
28
|
# File 'lib/faker/color.rb', line 25
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 ⇒ Object
12
13
14
15
|
# File 'lib/faker/color.rb', line 12
def single_rgb_color
@single_rgb_color = (0..255).to_a.sample
@single_rgb_color
end
|