vic 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vic/colorscheme.rb +12 -1
- data/lib/vic.rb +1 -1
- metadata +1 -1
data/lib/vic/colorscheme.rb
CHANGED
@@ -7,6 +7,13 @@ module Vic
|
|
7
7
|
instance_eval(&block) if block_given?
|
8
8
|
end
|
9
9
|
|
10
|
+
# Adds info to the header of the scheme, or retrieves the info hash.
|
11
|
+
#
|
12
|
+
# @return [Hash,String]
|
13
|
+
def info(args={})
|
14
|
+
(@info ||= {}).merge!(args) if args.respond_to? :merge
|
15
|
+
end
|
16
|
+
|
10
17
|
# Retrieves the background color.
|
11
18
|
#
|
12
19
|
# @return [String] 'light' or 'dark'
|
@@ -62,10 +69,13 @@ module Vic
|
|
62
69
|
@language = nil
|
63
70
|
end
|
64
71
|
|
72
|
+
# The colorscheme header
|
65
73
|
def header
|
66
74
|
<<-EOT.gsub(/^ {6}/, '')
|
67
75
|
" Vim color file
|
68
|
-
|
76
|
+
#{info.to_a.map do |pair|
|
77
|
+
pair.join(": ").tap {|s| s[0] = '" ' + s[0].upcase }
|
78
|
+
end.join("\n")}
|
69
79
|
set background=#{background}
|
70
80
|
hi clear
|
71
81
|
|
@@ -77,6 +87,7 @@ module Vic
|
|
77
87
|
EOT
|
78
88
|
end
|
79
89
|
|
90
|
+
# Creates the colorscheme file
|
80
91
|
def write
|
81
92
|
[header, highlights.map {|h| h.write }].join("\n")
|
82
93
|
end
|
data/lib/vic.rb
CHANGED