Class: NumPlot::RGB
- Inherits:
-
Object
- Object
- NumPlot::RGB
- Defined in:
- lib/numplot.rb
Overview
Class Method Summary (collapse)
-
+ (RGB) [](*args)
Create a new RGB object.
Instance Method Summary (collapse)
-
- (RGB) initialize(*args)
constructor
Create a new instance of RGB class.
Constructor Details
- (RGB) initialize(*args)
Create a new instance of RGB class.
You can give three styles of arguments to specify a color. * an RGB component as three integers like NumPlot::RGB.new(0, 255, 0) * a “#xxyyzz” style string like NumPlot::RGB.new(“#ff007f”) * a string of the name of a color like NumPlot::RGB.new(“blue”)
99 100 101 102 103 104 105 106 107 |
# File 'lib/numplot.rb', line 99 def initialize(*args) if args.size == 1 && String === args[0] @s = args[0] elsif args.size == 3 @s = "#%02x%02x%02x" % args else raise TypeError, "Unknown color format: #{args.inspect}" end end |
Class Method Details
+ (RGB) [](*args)
Create a new RGB object. See #initialize.
119 |
# File 'lib/numplot.rb', line 119 __yard_ignore_here{ alias [] new } |