10
11
12
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/coloration/writers/vim_theme_writer.rb', line 10
def build_result
add_line "\" Vim color file"
add_line "\" #{}"
add_line
add_line "set background=dark"
add_line "highlight clear"
add_line
add_line 'if exists("syntax_on")'
add_line " syntax reset"
add_line "endif"
add_line
add_line "let g:colors_name = \"#{@name}\""
add_line
default_style = Style.new(:fg => @ui["foreground"])
search_style = @items["variable"] || @items["entity"] || @items["keyword"] || default_style
border_color = @ui["background"].mix_with(@ui["foreground"], 81)
ui_mapping = {
"Cursor" => Style.new(:bg => @ui["caret"]),
"Visual" => Style.new(:bg => @ui["selection"]),
"CursorLine" => Style.new(:bg => @ui["lineHighlight"]),
"CursorColumn" => Style.new(:bg => @ui["lineHighlight"]),
"ColorColumn" => Style.new(:bg => @ui["lineHighlight"]),
"LineNr" => Style.new(:fg => @ui["foreground"].mix_with(@ui["background"], 50), :bg => @ui["lineHighlight"]),
"VertSplit" => Style.new(:fg => border_color, :bg => border_color),
"MatchParen" => @items["keyword"],
"StatusLine" => Style.new(:fg => @ui["foreground"], :bg => border_color, :bold => true),
"StatusLineNC" => Style.new(:fg => @ui["foreground"], :bg => border_color),
"Pmenu" => "entity.name",
"PmenuSel" => Style.new(:bg => @ui["selection"]),
"IncSearch" => Style.new(:bg => search_style.foreground.mix_with(@ui["background"], 33)),
"Search" => Style.new(:bg => search_style.foreground.mix_with(@ui["background"], 33)),
"Directory" => "constant.other.symbol",
"Folded" => Style.new(:fg => @items["comment"].try(:foreground), :bg => @ui["background"]),
}
ui_mapping.keys.each do |key|
add_line(format_item(key, ui_mapping[key] || default_style))
end
add_line
items_mapping = {
"Normal" => Style.new(:fg => @ui["foreground"], :bg => @ui["background"]),
"Boolean" => "constant.language",
"Character" => "constant.character",
"Comment" => "comment",
"Conditional" => "keyword.control",
"Constant" => "constant",
"Define" => "keyword",
"ErrorMsg" => "invalid",
"WarningMsg" => "invalid",
"Float" => "constant.numeric",
"Function" => "entity.name.function",
"Identifier" => "storage.type",
"Keyword" => "keyword",
"Label" => "string.other",
"NonText" => Style.new(:fg => @ui["invisibles"], :bg => @ui["lineHighlight"]),
"Number" => "constant.numeric",
"Operator" => "keyword.operator",
"PreProc" => "keyword.other",
"Special" => Style.new(:fg => @ui["foreground"]),
"SpecialKey" => Style.new(:fg => @ui["invisibles"], :bg => @ui["lineHighlight"]),
"Statement" => "keyword.control",
"StorageClass" => "storage.type",
"String" => "string,string.quoted",
"Tag" => "entity.name.tag",
"Title" => Style.new(:fg => @ui["foreground"], :bold => true),
"Todo" => (@items["comment"] || default_style).clone.tap { |c| c.inverse = true; c.bold = true },
"Type" => "entity.name.type",
"Underlined" => Style.new(:underline => true),
"rubyClass" => "keyword.controll.class.ruby",
"rubyFunction" => "entity.name.function.ruby",
"rubyInterpolationDelimiter" => "",
"rubySymbol" => "constant.other.symbol.ruby",
"rubyConstant" => "support.class",
"rubyStringDelimiter" => "string,string.quoted",
"rubyBlockParameter" => "variable.parameter",
"rubyInstanceVariable" => "variable.language",
"rubyInclude" => "keyword.other.special-method.ruby",
"rubyGlobalVariable" => "variable.other",
"rubyRegexp" => "string.regexp",
"rubyRegexpDelimiter" => "string.regexp",
"rubyEscape" => "constant.character.escape",
"rubyControl" => "keyword.control",
"rubyClassVariable" => "variable",
"rubyOperator" => "keyword.operator",
"rubyException" => "keyword.other.special-method.ruby",
"rubyPseudoVariable" => "variable.language.ruby",
"rubyRailsUserClass" => "support.class.ruby",
"rubyRailsARAssociationMethod" => "support.function.activerecord.rails",
"rubyRailsARMethod" => "support.function.activerecord.rails",
"rubyRailsRenderMethod" => "support.function",
"rubyRailsMethod" => "support.function",
"erubyDelimiter" => "punctuation.section.embedded.ruby",
"erubyComment" => "comment",
"erubyRailsMethod" => "support.function",
"htmlTag" => "meta.tag entity",
"htmlEndTag" => "meta.tag entity",
"htmlTagName" => "meta.tag entity",
"htmlArg" => "meta.tag entity",
"htmlSpecialChar" => "constant.character.entity.html",
"javaScriptFunction" => "storage.type.function.js",
"javaScriptRailsFunction" => "support.function",
"javaScriptBraces" => "meta.brace.curly.js",
"yamlKey" => "entity.name.tag.yaml",
"yamlAnchor" => "variable.other.yaml",
"yamlAlias" => "variable.other.yaml",
"yamlDocumentHeader" => "string.unquoted.yaml",
"cssURL" => "variable.parameter.misc.css",
"cssFunctionName" => "support.function.misc.css",
"cssColor" => "constant.other.color.rgb-value.css",
"cssPseudoClassId" => "entity.other.attribute-name.pseudo-class.css",
"cssClassName" => "entity.other.attribute-name.class.css",
"cssValueLength" => "constant.numeric.css",
"cssCommonAttr" => "support.constant.property-value.css",
"cssBraces" => "punctuation.section.property-list.css",
}
items_mapping.keys.each do |key|
add_line(format_item(key, items_mapping[key] || default_style))
end
self.result = @lines.join("\n")
end
|