Class: Coloractor
- Inherits:
-
Object
- Object
- Coloractor
- Defined in:
- lib/coloractor.rb
Defined Under Namespace
Classes: Palette
Instance Attribute Summary collapse
-
#background_color ⇒ Object
readonly
Returns the value of attribute background_color.
-
#dominant_colors ⇒ Object
readonly
Returns the value of attribute dominant_colors.
Class Method Summary collapse
Instance Method Summary collapse
- #extract_colors ⇒ Object
-
#initialize(filename) ⇒ Coloractor
constructor
A new instance of Coloractor.
Constructor Details
#initialize(filename) ⇒ Coloractor
11 12 13 14 |
# File 'lib/coloractor.rb', line 11 def initialize(filename) @filename = filename @dominant_colors = [] end |
Instance Attribute Details
#background_color ⇒ Object (readonly)
Returns the value of attribute background_color.
9 10 11 |
# File 'lib/coloractor.rb', line 9 def background_color @background_color end |
#dominant_colors ⇒ Object (readonly)
Returns the value of attribute dominant_colors.
9 10 11 |
# File 'lib/coloractor.rb', line 9 def dominant_colors @dominant_colors end |
Class Method Details
.extract_colors(filename) ⇒ Object
3 4 5 6 7 |
# File 'lib/coloractor.rb', line 3 def self.extract_colors(filename) new(filename).tap do |instance| instance.extract_colors end end |
Instance Method Details
#extract_colors ⇒ Object
16 17 18 19 20 21 |
# File 'lib/coloractor.rb', line 16 def extract_colors palette = Coloractor::Palette.build_from_file(@filename) @dominant_colors = palette.colors @background_color = palette.background_color end |