Sha256: 0e488f3b8e3887f6ef27f2b27f4ade8b36304b35b2d72bf4309ed5f629d30e44

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

java_import Java::Monkstone::ColorUtil

# class wraps a java color array, supports shuffle!, last and ruby_string
# as well as ability to initialize with an array of "web" color string
class ColorGroup
  attr_reader :colors
  def initialize(p5cols)
    @colors = p5cols
  end

  def self.from_web_array(web)
    ColorGroup.new(ColorUtil.web_array(web))
  end

  def shuffle!
    @colors = ColorUtil.shuffle(colors)
  end

  def ruby_string
    ColorUtil.rubyString(colors)
  end

  def last
    colors[0]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jruby_art-1.6.3 library/color_group/color_group.rb
jruby_art-1.6.2 library/color_group/color_group.rb
jruby_art-1.6.1 library/color_group/color_group.rb
jruby_art-1.6.0 library/color_group/color_group.rb