redgreenblue 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e6715019b7628fa8a5027295b3fb5e617f829d494eda1c4a0dad495adca6e44
4
- data.tar.gz: 745987a3b640392f140bc6f7d3d18575f815a75a00d96162a0a9f3cdba64cc71
3
+ metadata.gz: f836ad38758f98dc7f9d677e9bf97dcfd878a09e994622b16b4854d1bff01277
4
+ data.tar.gz: 938a0a5efefa5c4f181bccdb996be922ad51d8dfd7cfe623209d4582aa19d4e5
5
5
  SHA512:
6
- metadata.gz: 16538077413e35eeeae4d4da51bfd6eca7d7d3c9beba338df99742278762aa243dce8262fd9f95276154881dbdafe5ab26e4282ac2e485d82337f69a3bb61679
7
- data.tar.gz: 5dabac01d2f52b4cd187f4248a4d3a520e76ff5c419ead409468bb01b14935b67b528375fca2ad338d79f8257c74489511609da792a88f52f4eb8de670377cd6
6
+ metadata.gz: c40b54efa01653b785065707a57841fd156ba6238a4eccbc09454f969b1cfd08439bbb70431de985874606fe88115e7688dc2e8819c83335bbfd17a0c339a557
7
+ data.tar.gz: 4a7cdf6351af6e718ac857aaf87c052f1fc85110aca42eb049a22e18f63c25188a5e0189713ff46fa9ee7573e5a4d7729979fdf892a6c1a1f992fd127045618c
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # r, g, b methods
4
4
 
@@ -44,7 +44,7 @@ class RGB
44
44
  self.r, self.g, self.b = rgb.flatten
45
45
  end
46
46
 
47
- # Creates a new object from red, green, and blue components as integers in the range 0..255 (three 8-bit values).
47
+ # Creates a new Color object from red, green, and blue components as integers in the range 0..255 (three 8-bit values).
48
48
  def self.rgb(*rgb)
49
49
  c = self.new
50
50
  c.rgb = rgb
@@ -62,19 +62,36 @@ class RGB
62
62
  RGB.rgb rgb
63
63
  end
64
64
 
65
- # Calls the given block for each 24-bit RGB color (from black to white), passing the color as an RGB object.
66
- #
67
- # Returns the number of iterations.
68
- def self.each_24bit_color
69
- range = 0..255
70
- range.each do |r|
71
- range.each do |g|
72
- range.each do |b|
73
- yield self.rgb(r,g,b)
65
+ end
66
+
67
+ #----------------------------------------------------------------------#
68
+ # Module Methods #
69
+ #----------------------------------------------------------------------#
70
+
71
+ module RGB
72
+
73
+ class << self
74
+
75
+ # Creates a new Color object from red, green, and blue components as integers in the range 0..255 (three 8-bit values).
76
+ def rgb(*rgb)
77
+ Color.rgb(*rgb)
78
+ end
79
+
80
+ # Calls the given block for each 24-bit RGB color (from black to white), passing the color as an RGB::Color object.
81
+ #
82
+ # Returns the number of iterations.
83
+ def each_24bit_color
84
+ range = 0..255
85
+ range.each do |r|
86
+ range.each do |g|
87
+ range.each do |b|
88
+ yield self.rgb(r,g,b)
89
+ end
74
90
  end
75
91
  end
92
+ range.size ** 3
76
93
  end
77
- range.size ** 3
94
+
78
95
  end
79
96
 
80
97
  end
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # rr, gg, bb methods
4
4
 
@@ -44,7 +44,7 @@ class RGB
44
44
  self.rr, self.gg, self.bb = rrggbb.flatten
45
45
  end
46
46
 
47
- # Creates a new object from red, green, and blue components as integers in the range 0..65535 (three 16-bit values).
47
+ # Creates a new Color object from red, green, and blue components as integers in the range 0..65535 (three 16-bit values).
48
48
  def self.rrggbb(*rrggbb)
49
49
  c = self.new
50
50
  c.rrggbb = rrggbb
@@ -52,3 +52,20 @@ class RGB
52
52
  end
53
53
 
54
54
  end
55
+
56
+ #----------------------------------------------------------------------#
57
+ # Module Methods #
58
+ #----------------------------------------------------------------------#
59
+
60
+ module RGB
61
+
62
+ class << self
63
+
64
+ # Creates a new Color object from red, green, and blue components as integers in the range 0..65535 (three 16-bit values).
65
+ def rrggbb(*rrggbb)
66
+ Color.rrggbb(*rrggbb)
67
+ end
68
+
69
+ end
70
+
71
+ end
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  def initialize(*a)
4
4
  self.values = a.any? ? a : [ 0.5, 0.5, 0.5 ]
@@ -82,3 +82,17 @@ class RGB
82
82
  end
83
83
 
84
84
  end
85
+
86
+ # The main namespace for redgreenblue.
87
+ module RGB
88
+
89
+ class << self
90
+
91
+ # Creates a new Color object from red, green, and blue components as three values between 0 and 1.
92
+ def new(*a)
93
+ Color.new(*a)
94
+ end
95
+
96
+ end
97
+
98
+ end
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns a 3-byte string containing the object's color in BGR24 format.
4
4
  def bgr24
@@ -10,7 +10,7 @@ class RGB
10
10
  self.b, self.g, self.r = bgr_string.unpack('C3')
11
11
  end
12
12
 
13
- # Creates a new RGB object from BGR24 data (a 3-byte string).
13
+ # Creates a new RGB::Color object from BGR24 data (a 3-byte string).
14
14
  def self.bgr24(bgr)
15
15
  c = self.new
16
16
  c.bgr24 = bgr
@@ -18,3 +18,20 @@ class RGB
18
18
  end
19
19
 
20
20
  end
21
+
22
+ #----------------------------------------------------------------------#
23
+ # Module Methods #
24
+ #----------------------------------------------------------------------#
25
+
26
+ module RGB
27
+
28
+ class << self
29
+
30
+ # Creates a new RGB::Color object from BGR24 data (a 3-byte string).
31
+ def bgr24(bgr)
32
+ Color.bgr24(bgr)
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -1,6 +1,6 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
- # Returns CIE 1931 XYZ values for the RGB object.
3
+ # Returns CIE 1931 XYZ values for the RGB::Color object.
4
4
  #
5
5
  # Based on:
6
6
  # - http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html
@@ -21,7 +21,7 @@ class RGB
21
21
 
22
22
  alias xyz cie_xyz
23
23
 
24
- # Returns CIE 1931 xyY values for the RGB object.
24
+ # Returns CIE 1931 xyY values for the RGB::Color object.
25
25
  #
26
26
  # Based on:
27
27
  # - https://en.wikipedia.org/wiki/CIE_1931_color_space
@@ -41,7 +41,7 @@ class RGB
41
41
 
42
42
  alias xyy cie_xyy
43
43
 
44
- # Returns CIE 1931 xy values for the RGB object.
44
+ # Returns CIE 1931 xy values for the RGB::Color object.
45
45
  def cie_xy
46
46
  cie_xyy[0..1]
47
47
  end
@@ -1,27 +1,27 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
- # Returns CIE 1976 L*a*b* (CIELAB) values for the RGB object.
3
+ # Returns CIE 1976 L*a*b* (CIELAB) values for the RGB::Color object.
4
4
  def cie_lab(round: true)
5
5
  cie_lab_luv(round: round, type: :lab)
6
6
  end
7
7
 
8
8
  alias lab cie_lab
9
9
 
10
- # Returns CIE 1976 LCHab values for the RGB object, derived from L*a*b* (CIELAB).
10
+ # Returns CIE 1976 LCHab values for the RGB::Color object, derived from L*a*b* (CIELAB).
11
11
  #
12
12
  # When C is 0, H is nil.
13
13
  def cie_lch_ab
14
14
  cie_lch_ab_uv(type: :lab)
15
15
  end
16
16
 
17
- # Returns CIE 1976 L*u*v* (CIELUV) values for the RGB object.
17
+ # Returns CIE 1976 L*u*v* (CIELUV) values for the RGB::Color object.
18
18
  def cie_luv(round: true)
19
19
  cie_lab_luv(round: round, type: :luv)
20
20
  end
21
21
 
22
22
  alias luv cie_luv
23
23
 
24
- # Returns CIE 1976 LCHuv values for the RGB object, derived from L*u*v* (CIELUV).
24
+ # Returns CIE 1976 LCHuv values for the RGB::Color object, derived from L*u*v* (CIELUV).
25
25
  #
26
26
  # When C is 0, H is nil.
27
27
  def cie_lch_uv
@@ -44,7 +44,7 @@ class RGB
44
44
 
45
45
  private
46
46
 
47
- # Returns either CIE 1976 L*a*b* (CIELAB) or CIE 1976 L*u*v* (CIELUV) values for the RGB object.
47
+ # Returns either CIE 1976 L*a*b* (CIELAB) or CIE 1976 L*u*v* (CIELUV) values for the RGB::Color object.
48
48
  #
49
49
  # L*a*b* formula based on:
50
50
  # - http://www.brucelindbloom.com/Eqn_XYZ_to_Lab.html
@@ -82,7 +82,7 @@ class RGB
82
82
  end.map { |v| v.nan? ? 0.0 : ( round ? v.round(8) : v ) }
83
83
  end
84
84
 
85
- # Returns either CIE 1976 LCHab or CIE 1976 LCHuv values for the RGB object.
85
+ # Returns either CIE 1976 LCHab or CIE 1976 LCHuv values for the RGB::Color object.
86
86
  #
87
87
  # Based on:
88
88
  # - http://www.brucelindbloom.com/Eqn_Lab_to_LCH.html
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns the difference between this (reference) color and another color, according to the CIE 1994 delta E formula.
4
4
  #
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns gamma-expanded (inverse-companded) RGB values for the object (three values between 0 and 1).
4
4
  #
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns a 1-pixel GIF image set to the color.
4
4
  #
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  #----------------------------------------------------------------------#
4
4
  # Class Methods #
@@ -6,13 +6,13 @@ class RGB
6
6
 
7
7
  class << self
8
8
 
9
- # Creates a new RGB object from a line of gpl (Gimp color palette) input. Returns nil if not successful.
9
+ # Creates a new RGB::Color object from a line of gpl (Gimp color palette) input. Returns nil if not successful.
10
10
  #
11
11
  # @example
12
- # RGB.gpl "255 153 204\tpink"
12
+ # RGB::Color.gpl "255 153 204\tpink"
13
13
  def gpl(line)
14
14
  if line.chomp.match( /^\s*(?<r>\d{1,3})\s+(?<g>\d{1,3})\s+(?<b>\d{1,3})(\s+(?<name>.*))?/ )
15
- color = RGB.rgb $~[:r].to_i, $~[:g].to_i, $~[:b].to_i
15
+ color = RGB::Color.rgb $~[:r].to_i, $~[:g].to_i, $~[:b].to_i
16
16
  color.name = $~[:name] if $~[:name]
17
17
  color
18
18
  else
@@ -20,7 +20,49 @@ class RGB
20
20
  end
21
21
  end
22
22
 
23
- # Loads a gpl (Gimp color palette) source and returns an array of RGB objects.
23
+ end
24
+
25
+ #----------------------------------------------------------------------#
26
+ # Instance Methods #
27
+ #----------------------------------------------------------------------#
28
+
29
+ # Returns the color in the format used in .gpl files (Gimp color palettes), including its name (if present).
30
+ #
31
+ # You can optionally supply a name as argument.
32
+ def gpl(gpl_name=name)
33
+ ( "%3d %3d %3d" % rgb ) +
34
+ ( gpl_name.to_s.size != 0 ? "\t#{gpl_name}" : '' )
35
+ end
36
+
37
+ end
38
+
39
+
40
+ module RGB
41
+
42
+ class << self
43
+
44
+ # Creates a new RGB::Color object from a line of gpl (Gimp color palette) input. Returns nil if not successful.
45
+ #
46
+ # @example
47
+ # RGB.gpl "255 153 204\tpink"
48
+ def gpl(line)
49
+ Color.gpl(line)
50
+ end
51
+
52
+ # Returns a header for a .gpl file (Gimp color palette). Includes an optional name and number of columns.
53
+ #
54
+ # @example
55
+ # RGB.gpl_header('Spring')
56
+ #
57
+ # Reverse-engineered from:
58
+ # - https://github.com/GNOME/gimp/blob/5d79fba8238a27b8691556489898d33b3fa0dda0/app/core/gimppalette-load.c
59
+ def gpl_header(name=nil, columns: nil)
60
+ "GIMP Palette\n" +
61
+ ( name ? "Name: #{name}\n" : '' ) +
62
+ ( columns ? "Columns: #{columns}\n" : '' )
63
+ end
64
+
65
+ # Loads a gpl (Gimp color palette) source and returns an array of RGB::Color objects.
24
66
  #
25
67
  # Options:
26
68
  # - file: Path to a .gpl file to be loaded.
@@ -47,7 +89,7 @@ class RGB
47
89
  end
48
90
 
49
91
  if source.respond_to? :each_line
50
- list = source.each_line.map { |line| RGB.gpl(line) }
92
+ list = source.each_line.map { |line| Color.gpl(line) }
51
93
 
52
94
  if compact
53
95
  list.compact!
@@ -64,31 +106,6 @@ class RGB
64
106
  end
65
107
  end
66
108
 
67
- # Returns a header for a .gpl file (Gimp color palette). Includes an optional name and number of columns.
68
- #
69
- # @example
70
- # RGB.gpl_header('Spring')
71
- #
72
- # Reverse-engineered from:
73
- # - https://github.com/GNOME/gimp/blob/5d79fba8238a27b8691556489898d33b3fa0dda0/app/core/gimppalette-load.c
74
- def gpl_header(name=nil, columns: nil)
75
- "GIMP Palette\n" +
76
- ( name ? "Name: #{name}\n" : '' ) +
77
- ( columns ? "Columns: #{columns}\n" : '' )
78
- end
79
-
80
- end
81
-
82
- #----------------------------------------------------------------------#
83
- # Instance Methods #
84
- #----------------------------------------------------------------------#
85
-
86
- # Returns the color in the format used in .gpl files (Gimp color palettes), including its name (if present).
87
- #
88
- # You can optionally supply a name as argument.
89
- def gpl(gpl_name=name)
90
- ( "%3d %3d %3d" % rgb ) +
91
- ( gpl_name.to_s.size != 0 ? "\t#{gpl_name}" : '' )
92
109
  end
93
110
 
94
111
  end
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns a 6-digit hexadecimal string representing the object's red, green, and blue components as 8-bit values.
4
4
  #
@@ -22,11 +22,17 @@ class RGB
22
22
  end
23
23
  end
24
24
 
25
+ private
25
26
 
26
- # Class methods
27
+ def hex6
28
+ '%02x%02x%02x' % [ r, g, b ]
29
+ end
27
30
 
31
+ #----------------------------------------------------------------------#
32
+ # Class Methods #
33
+ #----------------------------------------------------------------------#
28
34
 
29
- # Creates a new object from a 6- or 3-digit hexadecimal string representing red, green, and blue.
35
+ # Creates a new Color object from a 6- or 3-digit hexadecimal string representing red, green, and blue.
30
36
  #
31
37
  # The string may include a '#' prefix.
32
38
  def self.hex(hex_string)
@@ -37,31 +43,40 @@ class RGB
37
43
  end
38
44
  end
39
45
 
40
- # Returns a 3-digit shorthand version of a 6-digit hexadecimal string.
41
- #
42
- # If a shorthand version is not possible, returns the original string.
43
- def self.hex_shorthand(hex_string)
44
- hex_string.sub( /^(#?)(\h)\2(\h)\3(\h)\4$/, '\1\2\3\4' )
45
- end
46
+ end
46
47
 
47
- # Parses a 6- or 3-digit hexadecimal string.
48
- # Returns three integers in the range 0..255, or nil if not successful.
49
- #
50
- # The string may include a '#' prefix.
51
- def self.hex_to_rgb(hex_string)
52
- if hex_string =~ /^(#?)(\h\h)(\h\h)(\h\h)$/
53
- [$2, $3, $4].map { |h| h.to_i(16) }
54
- elsif hex_string =~ /^(#?)(\h)(\h)(\h)$/
55
- [$2, $3, $4].map { |h| (h*2).to_i(16) }
56
- else
57
- nil
48
+ module RGB
49
+
50
+ class << self
51
+
52
+ # Creates a new Color object from a 6- or 3-digit hexadecimal string representing red, green, and blue.
53
+ #
54
+ # The string may include a '#' prefix.
55
+ def hex(hex_string)
56
+ Color.hex(hex_string)
58
57
  end
59
- end
60
58
 
61
- private
59
+ # Returns a 3-digit shorthand version of a 6-digit hexadecimal string.
60
+ #
61
+ # If a shorthand version is not possible, returns the original string.
62
+ def hex_shorthand(hex_string)
63
+ hex_string.sub( /^(#?)(\h)\2(\h)\3(\h)\4$/, '\1\2\3\4' )
64
+ end
65
+
66
+ # Parses a 6- or 3-digit hexadecimal string.
67
+ # Returns three integers in the range 0..255, or nil if not successful.
68
+ #
69
+ # The string may include a '#' prefix.
70
+ def hex_to_rgb(hex_string)
71
+ if hex_string =~ /^(#?)(\h\h)(\h\h)(\h\h)$/
72
+ [$2, $3, $4].map { |h| h.to_i(16) }
73
+ elsif hex_string =~ /^(#?)(\h)(\h)(\h)$/
74
+ [$2, $3, $4].map { |h| (h*2).to_i(16) }
75
+ else
76
+ nil
77
+ end
78
+ end
62
79
 
63
- def hex6
64
- '%02x%02x%02x' % [ r, g, b ]
65
80
  end
66
81
 
67
82
  end
@@ -1,6 +1,6 @@
1
1
  require 'redgreenblue/hsv'
2
2
 
3
- class RGB
3
+ class RGB::Color
4
4
 
5
5
  #----------------------------------------------------------------------#
6
6
  # Class Methods #
@@ -8,7 +8,7 @@ class RGB
8
8
 
9
9
  class << self
10
10
 
11
- # Creates a new RGB object from HSB values: hue (0..360), saturation (0..1), and brightness (0..1).
11
+ # Creates a new RGB::Color object from HSB values: hue (0..360), saturation (0..1), and brightness (0..1).
12
12
  alias hsb hsv
13
13
 
14
14
  end
@@ -55,7 +55,22 @@ class RGB
55
55
  # Sets red, green, and blue by rotating the object's HSB-hue a number of degrees.
56
56
  alias hsb_rotate! hsv_rotate!
57
57
 
58
- # Creates one or more new RGB objects by rotating this object's HSB-hue a number of degrees.
58
+ # Creates one or more new RGB::Color objects by rotating this object's HSB-hue a number of degrees.
59
59
  alias hsb_rotate hsv_rotate
60
60
 
61
61
  end
62
+
63
+ #----------------------------------------------------------------------#
64
+ # Module Methods #
65
+ #----------------------------------------------------------------------#
66
+
67
+ module RGB
68
+
69
+ class << self
70
+
71
+ # Creates a new RGB::Color object from HSB values: hue (0..360), saturation (0..1), and brightness (0..1).
72
+ alias hsb hsv
73
+
74
+ end
75
+
76
+ end
@@ -1,7 +1,7 @@
1
1
  require 'redgreenblue/hsx_shared'
2
2
  require 'redgreenblue/math'
3
3
 
4
- class RGB
4
+ class RGB::Color
5
5
 
6
6
  #----------------------------------------------------------------------#
7
7
  # Class Methods #
@@ -9,7 +9,7 @@ class RGB
9
9
 
10
10
  class << self
11
11
 
12
- # Creates a new RGB object from HSL values: hue (0..360), saturation (0..1), and lightness (0..1).
12
+ # Creates a new RGB::Color object from HSL values: hue (0..360), saturation (0..1), and lightness (0..1).
13
13
  def hsl(*a)
14
14
  new hsl_to_values(*a)
15
15
  end
@@ -51,7 +51,7 @@ class RGB
51
51
 
52
52
  # Sets red, green, and blue using HSL values: hue (0..360), saturation (0..1), and lightness (0..1).
53
53
  def hsl=(*a)
54
- self.values = RGB.hsl_to_values(*a)
54
+ self.values = RGB::Color.hsl_to_values(*a)
55
55
  end
56
56
 
57
57
  # Sets HSL-hue to a number of degrees (0..360) or nil.
@@ -84,7 +84,7 @@ class RGB
84
84
  self
85
85
  end
86
86
 
87
- # Creates one or more new RGB objects by rotating this object's HSL-hue a number of degrees.
87
+ # Creates one or more new RGB::Color objects by rotating this object's HSL-hue a number of degrees.
88
88
  def hsl_rotate(a_degrees, *b_degrees)
89
89
  if a_degrees.class != Array and b_degrees.none?
90
90
  RGB.hsl zip_add(hsl, [a_degrees, 0, 0])
@@ -94,3 +94,20 @@ class RGB
94
94
  end
95
95
 
96
96
  end
97
+
98
+ #----------------------------------------------------------------------#
99
+ # Module Methods #
100
+ #----------------------------------------------------------------------#
101
+
102
+ module RGB
103
+
104
+ class << self
105
+
106
+ # Creates a new RGB::Color object from HSL values: hue (0..360), saturation (0..1), and lightness (0..1).
107
+ def hsl(*a)
108
+ Color.hsl(*a)
109
+ end
110
+
111
+ end
112
+
113
+ end
@@ -1,7 +1,7 @@
1
1
  require 'redgreenblue/hsx_shared'
2
2
  require 'redgreenblue/math'
3
3
 
4
- class RGB
4
+ class RGB::Color
5
5
 
6
6
  #----------------------------------------------------------------------#
7
7
  # Class Methods #
@@ -9,7 +9,7 @@ class RGB
9
9
 
10
10
  class << self
11
11
 
12
- # Creates a new RGB object from HSV values: hue (0..360), saturation (0..1), and value (0..1).
12
+ # Creates a new RGB::Color object from HSV values: hue (0..360), saturation (0..1), and value (0..1).
13
13
  def hsv(*a)
14
14
  new hsv_to_values(*a)
15
15
  end
@@ -51,7 +51,7 @@ class RGB
51
51
 
52
52
  # Sets red, green, and blue using HSV values: hue (0..360), saturation (0..1), and value (0..1).
53
53
  def hsv=(*a)
54
- self.values = RGB.hsv_to_values(*a)
54
+ self.values = RGB::Color.hsv_to_values(*a)
55
55
  end
56
56
 
57
57
  # Sets HSV-hue to a number of degrees (0..360) or nil.
@@ -84,7 +84,7 @@ class RGB
84
84
  self
85
85
  end
86
86
 
87
- # Creates one or more new RGB objects by rotating this object's HSV-hue a number of degrees.
87
+ # Creates one or more new RGB::Color objects by rotating this object's HSV-hue a number of degrees.
88
88
  def hsv_rotate(a_degrees, *b_degrees)
89
89
  if a_degrees.class != Array and b_degrees.none?
90
90
  RGB.hsv zip_add(hsv, [a_degrees, 0, 0])
@@ -94,3 +94,20 @@ class RGB
94
94
  end
95
95
 
96
96
  end
97
+
98
+ #----------------------------------------------------------------------#
99
+ # Module Methods #
100
+ #----------------------------------------------------------------------#
101
+
102
+ module RGB
103
+
104
+ class << self
105
+
106
+ # Creates a new RGB::Color object from HSV values: hue (0..360), saturation (0..1), and value (0..1).
107
+ def hsv(*a)
108
+ Color.hsv(*a)
109
+ end
110
+
111
+ end
112
+
113
+ end
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  #----------------------------------------------------------------------#
4
4
  # Class Methods #
@@ -1,4 +1,4 @@
1
- class RGB
1
+ class RGB::Color
2
2
 
3
3
  # Returns the color's hue (0..360), whiteness (0..1), and blackness (0..1), as defined by the HWB color model.
4
4
  #