Class: Styles::Properties::MatchColor

Inherits:
Base
  • Object
show all
Defined in:
lib/styles/properties/match_color.rb

Constant Summary collapse

COLOR_PROPERTY_TYPE =
:match

Instance Attribute Summary

Attributes inherited from Base

#name, #selector, #value

Instance Method Summary collapse

Methods inherited from Base

#colors, #initialize, multiple_names?, names, other_names, sub_engine, sub_engines, to_sym

Constructor Details

This class inherits a constructor from Styles::Properties::Base

Instance Method Details

#color_to_useObject



12
13
14
15
16
17
18
# File 'lib/styles/properties/match_color.rb', line 12

def color_to_use
  if value.is_a? Array
    value.map { |color| color == :none ? :no_fg_color : color }
  elsif value.is_a? Symbol
    value == :none ? :no_fg_color : value
  end
end

#valid_value?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/styles/properties/match_color.rb', line 8

def valid_value?
  [value].flatten.all? { |color| colors.is_basic_color?(color) || color == :none }
end