Method: Colorable::Color#next

Defined in:
lib/colorable/color.rb

#next(n = 1) ⇒ Object Also known as: succ

Returns a next color object in X11 colors. The color sequence is determined by its color mode.



104
105
106
107
108
# File 'lib/colorable/color.rb', line 104

def next(n=1)
  @@colorset[mode] ||= Colorable::Colorset.new(order: mode)
  idx = @@colorset[mode].find_index(self)
  @@colorset[mode].at(idx+n).tap{|c| c.mode = mode } if idx
end