Class: Camalian::Palette
- Inherits:
-
Array
- Object
- Array
- Camalian::Palette
- Defined in:
- lib/camalian/palette.rb
Instance Method Summary collapse
- #light_colors(limit1, limit2) ⇒ Object
- #sort_by_hue ⇒ Object
- #sort_by_lightness ⇒ Object
- #sort_by_saturation ⇒ Object
- #sort_similar_colors ⇒ Object
Instance Method Details
#light_colors(limit1, limit2) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/camalian/palette.rb', line 20 def light_colors(limit1, limit2) min = [limit1, limit2].min max = [limit1, limit2].max table = self.dup Palette.new(table.delete_if { |color| color.l > max or color.l < min }) end |
#sort_by_hue ⇒ Object
8 9 10 |
# File 'lib/camalian/palette.rb', line 8 def sort_by_hue Palette.new(self.sort_by { |a| a.h }.reverse) end |
#sort_by_lightness ⇒ Object
4 5 6 |
# File 'lib/camalian/palette.rb', line 4 def sort_by_lightness Palette.new(self.sort_by { |a| a.l }.reverse) end |
#sort_by_saturation ⇒ Object
16 17 18 |
# File 'lib/camalian/palette.rb', line 16 def sort_by_saturation Palette.new(self.sort_by { |a| a.s }.reverse) end |
#sort_similar_colors ⇒ Object
12 13 14 |
# File 'lib/camalian/palette.rb', line 12 def sort_similar_colors Palette.new(self.sort_by { |a| a.hsv }) end |