coloration 0.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,16 +51,21 @@ module Coloration
|
|
51
51
|
@score_manager = Textpow::ScoreManager.new
|
52
52
|
end
|
53
53
|
|
54
|
-
def [](
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
def [](keys)
|
55
|
+
keys.split(",").each do |key|
|
56
|
+
best_selector = nil
|
57
|
+
best_score = 0
|
58
|
+
@items.keys.each do |selector|
|
59
|
+
score = @score_manager.score(selector, key)
|
60
|
+
if score > best_score
|
61
|
+
best_score, best_selector = score, selector
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if best_selector
|
65
|
+
return @items[best_selector]
|
61
66
|
end
|
62
67
|
end
|
63
|
-
|
68
|
+
nil
|
64
69
|
end
|
65
70
|
end
|
66
71
|
end
|
data/lib/coloration/version.rb
CHANGED
@@ -22,7 +22,7 @@ module Coloration
|
|
22
22
|
|
23
23
|
items_mapping = {
|
24
24
|
"view.style.comment1" => @items["comment"], # #foo
|
25
|
-
"view.style.literal1" => @items["string"], # "foo"
|
25
|
+
"view.style.literal1" => @items["string,string.quoted"], # "foo"
|
26
26
|
"view.style.label" => @items["constant.other.symbol"], # :foo
|
27
27
|
"view.style.digit" => @items["constant.numeric"], # 123
|
28
28
|
"view.style.keyword1" => @items["keyword.control"], # class, def, if, end
|
@@ -26,7 +26,7 @@ module Coloration
|
|
26
26
|
"Normal" => nil,
|
27
27
|
"Others" => nil,
|
28
28
|
"Region Marker" => nil,
|
29
|
-
"String" => @items["string"]
|
29
|
+
"String" => @items["string,string.quoted"]
|
30
30
|
}
|
31
31
|
|
32
32
|
items_mapping.keys.each do |key|
|
@@ -68,7 +68,7 @@ module Coloration
|
|
68
68
|
add_line "Ruby/Rails/RHTML:Message=0," + format_style(@default_style)
|
69
69
|
add_line "Ruby/Rails/RHTML:Raw String=0," + format_style(@items["string.quoted.single"])
|
70
70
|
add_line "Ruby/Rails/RHTML:Symbol=0," + format_style(@items["constant.other.symbol.ruby"])
|
71
|
-
add_line "Ruby/Rails/RHTML:Value=0," + format_style(@items["string"])
|
71
|
+
add_line "Ruby/Rails/RHTML:Value=0," + format_style(@items["string,string.quoted"])
|
72
72
|
add_line "Ruby/Rails/RHTML:Element=0," + format_style(@items["meta.tag"] || @items["entity.name.tag"])
|
73
73
|
add_line "Ruby/Rails/RHTML:Kernel methods=0," + format_style(@items["support.function"])
|
74
74
|
add_line "Ruby/Rails/RHTML:Attribute=0," + format_style(@items["entity.other.attribute-name"])
|
@@ -76,7 +76,7 @@ module Coloration
|
|
76
76
|
add_line
|
77
77
|
|
78
78
|
add_line "[Highlighting XML - Schema #{name}]"
|
79
|
-
add_line "XML:Value=0," + format_style(@items["string"])
|
79
|
+
add_line "XML:Value=0," + format_style(@items["string,string.quoted"])
|
80
80
|
add_line "XML:Element=0," + format_style(@items["meta.tag"] || @items["entity.name.tag"])
|
81
81
|
add_line "XML:Attribute=0," + format_style(@items["entity.other.attribute-name"])
|
82
82
|
|
@@ -17,17 +17,20 @@ module Coloration
|
|
17
17
|
add_line "let g:colors_name = \"#{@name}\""
|
18
18
|
add_line
|
19
19
|
|
20
|
-
|
20
|
+
default_style = Style.new(:fg => @ui["foreground"])
|
21
|
+
search_style = @items["variable"] || @items["entity"] || @items["keyword"] || default_style
|
22
|
+
border_color = @ui["background"].lighten_by(81)
|
23
|
+
|
21
24
|
ui_mapping = {
|
22
25
|
"Cursor" => Style.new(:bg => @ui["caret"]),
|
23
26
|
"Visual" => Style.new(:bg => @ui["selection"]),
|
24
27
|
"CursorLine" => Style.new(:bg => @ui["lineHighlight"]),
|
25
28
|
"CursorColumn" => Style.new(:bg => @ui["lineHighlight"]),
|
26
29
|
"LineNr" => Style.new(:fg => @ui["foreground"].mix_with(@ui["background"], 50), :bg => @ui["background"]),
|
27
|
-
"VertSplit" => Style.new(:fg =>
|
30
|
+
"VertSplit" => Style.new(:fg => border_color, :bg => border_color),
|
28
31
|
"MatchParen" => @items["keyword"],
|
29
|
-
"StatusLine" => Style.new(:fg => @ui["foreground"], :bg =>
|
30
|
-
"StatusLineNC" => Style.new(:fg => @ui["foreground"], :bg =>
|
32
|
+
"StatusLine" => Style.new(:fg => @ui["foreground"], :bg => border_color, :bold => true),
|
33
|
+
"StatusLineNC" => Style.new(:fg => @ui["foreground"], :bg => border_color),
|
31
34
|
"Pmenu" => "entity.name",
|
32
35
|
"PmenuSel" => Style.new(:bg => @ui["selection"]),
|
33
36
|
"IncSearch" => Style.new(:bg => search_style.foreground.mix_with(@ui["background"], 33)),
|
@@ -37,7 +40,7 @@ module Coloration
|
|
37
40
|
}
|
38
41
|
|
39
42
|
ui_mapping.keys.each do |key|
|
40
|
-
add_line(format_item(key, ui_mapping[key]))
|
43
|
+
add_line(format_item(key, ui_mapping[key] || default_style))
|
41
44
|
end
|
42
45
|
|
43
46
|
add_line
|
@@ -75,7 +78,7 @@ module Coloration
|
|
75
78
|
"SpecialKey" => Style.new(:fg => @ui["invisibles"], :bg => @ui["lineHighlight"]),
|
76
79
|
"Statement" => "keyword.control",
|
77
80
|
"StorageClass" => "storage.type",
|
78
|
-
"String" => "string",
|
81
|
+
"String" => "string,string.quoted",
|
79
82
|
#"Structure" => [],
|
80
83
|
"Tag" => "entity.name.tag",
|
81
84
|
"Title" => Style.new(:fg => @ui["foreground"], :bold => true),
|
@@ -89,8 +92,8 @@ module Coloration
|
|
89
92
|
"rubyFunction" => "entity.name.function.ruby",
|
90
93
|
"rubyInterpolationDelimiter" => "",
|
91
94
|
"rubySymbol" => "constant.other.symbol.ruby",
|
92
|
-
"rubyConstant" => "support",
|
93
|
-
"rubyStringDelimiter" => "string",
|
95
|
+
"rubyConstant" => "support.class",
|
96
|
+
"rubyStringDelimiter" => "string,string.quoted",
|
94
97
|
"rubyBlockParameter" => "variable.parameter",
|
95
98
|
"rubyInstanceVariable" => "variable.language",
|
96
99
|
"rubyInclude" => "keyword.other.special-method.ruby",
|
@@ -147,8 +150,6 @@ module Coloration
|
|
147
150
|
"cssBraces" => "punctuation.section.property-list.css",
|
148
151
|
}
|
149
152
|
|
150
|
-
default_style = Style.new
|
151
|
-
default_style.foreground = @ui["foreground"]
|
152
153
|
items_mapping.keys.each do |key|
|
153
154
|
add_line(format_item(key, items_mapping[key] || default_style))
|
154
155
|
end
|