Class: Ruco::TMTheme
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#foreground ⇒ Object
Returns the value of attribute foreground.
-
#styles ⇒ Object
Returns the value of attribute styles.
Instance Method Summary collapse
-
#initialize(file) ⇒ TMTheme
constructor
not supported in Curses …
Constructor Details
#initialize(file) ⇒ TMTheme
not supported in Curses … attr_accessor :invisibles, :caret, :selection
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ruco/tm_theme.rb', line 13 def initialize(file) raw = Plist.parse_xml(file) raise "Theme not found in #{file}" unless raw rules = raw['settings'] @styles = {} # set global styles global = rules.shift['settings'] self.background = global['background'] self.foreground = global['foreground'] # set scope styles rules.each do |rules| style = [ rules['settings']['foreground'], rules['settings']['background'], ] next if style == [nil, nil] # some weird themes have rules without colors... next unless scope = rules['scope'] # some weird themes have rules without scopes... scope.split(/, ?/).map(&:strip).each do |scope| @styles[scope] = style unless nested_scope?(scope) end end end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
5 6 7 |
# File 'lib/ruco/tm_theme.rb', line 5 def background @background end |
#foreground ⇒ Object
Returns the value of attribute foreground.
5 6 7 |
# File 'lib/ruco/tm_theme.rb', line 5 def foreground @foreground end |
#styles ⇒ Object
Returns the value of attribute styles.
5 6 7 |
# File 'lib/ruco/tm_theme.rb', line 5 def styles @styles end |