Class: Nyaplot::Colors

Inherits:
Object
  • Object
show all
Defined in:
lib/nyaplot/color.rb

Overview

The interface to access Colorbrewer through Nyaplot::Color

Class Method Summary collapse

Class Method Details

.div(num) ⇒ Nyaplot::Color

Returns A colorset randomly selected from diverging ones.

Returns:

  • (Nyaplot::Color)

    A colorset randomly selected from diverging ones



41
42
43
44
# File 'lib/nyaplot/color.rb', line 41

define_method(:div) {|num=nil|
  seq = color_set.select{|name, colors| colors["type"] == "div"}
  self.send(seq.keys.sample, num)
}

.listsArray<String>

Returns the list of names of prepared colorsets.

Returns:

  • (Array<String>)

    the list of names of prepared colorsets



22
# File 'lib/nyaplot/color.rb', line 22

define_method(:lists) {color_set.keys}

.qual(num) ⇒ Nyaplot::Color

Returns A colorset randomly selected from qualitative ones.

Returns:

  • (Nyaplot::Color)

    A colorset randomly selected from qualitative ones



34
35
36
37
# File 'lib/nyaplot/color.rb', line 34

define_method(:qual) {|num=nil|
  seq = color_set.select{|name, colors| colors["type"] == "qual"}
  self.send(seq.keys.sample, num)
}

.seq(num) ⇒ Nyaplot::Color

Returns A colorset randomly selected from sequential ones.

Returns:

  • (Nyaplot::Color)

    A colorset randomly selected from sequential ones



27
28
29
30
# File 'lib/nyaplot/color.rb', line 27

define_method(:seq) {|num=nil|
  seq = color_set.select{|name, colors| colors["type"] == "seq"}
  self.send(seq.keys.sample, num)
}