palette 0.0.6 → 0.0.7
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.
- data/features/cli.feature +7 -7
- data/lib/palette/color_scheme.rb +7 -4
- data/lib/palette/rule.rb +7 -5
- data/lib/palette/version.rb +1 -1
- data/spec/rule_spec.rb +6 -6
- metadata +2 -42
data/features/cli.feature
CHANGED
@@ -44,9 +44,9 @@ Feature: Run palette from the command line
|
|
44
44
|
set background=light
|
45
45
|
endif
|
46
46
|
|
47
|
-
hi Normal guifg=#000000 ctermfg=16 guibg=#FFFFFF ctermbg=231
|
48
|
-
hi Identifier guifg=#FFFFFF ctermfg=231 guibg=#000000 ctermbg=16
|
49
|
-
hi Comment guifg=NONE ctermfg=NONE guibg=NONE ctermbg=NONE
|
47
|
+
hi Normal guifg=#000000 ctermfg=16 guibg=#FFFFFF ctermbg=231 gui=NONE cterm=NONE
|
48
|
+
hi Identifier guifg=#FFFFFF ctermfg=231 guibg=#000000 ctermbg=16 gui=NONE cterm=NONE
|
49
|
+
hi Comment guifg=NONE ctermfg=NONE guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
|
50
50
|
|
51
51
|
hi link rubyDelimiter String
|
52
52
|
hi link rubyInterpolationDelimiter String
|
@@ -63,8 +63,8 @@ Feature: Run palette from the command line
|
|
63
63
|
When I run `palette valid_scheme`
|
64
64
|
Then the output should contain:
|
65
65
|
"""
|
66
|
-
hi Normal guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51
|
67
|
-
hi Identifier guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51
|
66
|
+
hi Normal guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51 gui=NONE cterm=NONE
|
67
|
+
hi Identifier guifg=#999999 ctermfg=246 guibg=#00FFFF ctermbg=51 gui=NONE cterm=NONE
|
68
68
|
"""
|
69
69
|
|
70
70
|
Scenario: Process a nonexistant file
|
@@ -94,8 +94,8 @@ Feature: Run palette from the command line
|
|
94
94
|
When I run `palette valid_theme`
|
95
95
|
Then the output should contain:
|
96
96
|
"""
|
97
|
-
hi String guifg=#000000 ctermfg=16 guibg=#FFFFFF ctermbg=231
|
98
|
-
hi Float guifg=#FFFFFF ctermfg=231 guibg=#000000 ctermbg=16
|
97
|
+
hi String guifg=#000000 ctermfg=16 guibg=#FFFFFF ctermbg=231 gui=NONE cterm=NONE
|
98
|
+
hi Float guifg=#FFFFFF ctermfg=231 guibg=#000000 ctermbg=16 gui=NONE cterm=NONE
|
99
99
|
"""
|
100
100
|
|
101
101
|
Scenario: Process a file where links are self-referential
|
data/lib/palette/color_scheme.rb
CHANGED
@@ -5,7 +5,13 @@ module Palette
|
|
5
5
|
attr_reader :name
|
6
6
|
|
7
7
|
def initialize(color_name)
|
8
|
-
@name
|
8
|
+
@name = color_name
|
9
|
+
@notes = nil
|
10
|
+
@links = []
|
11
|
+
@rules = []
|
12
|
+
@reset = false
|
13
|
+
@background = nil
|
14
|
+
@author_name = nil
|
9
15
|
end
|
10
16
|
|
11
17
|
def author(author_name)
|
@@ -26,7 +32,6 @@ module Palette
|
|
26
32
|
end
|
27
33
|
|
28
34
|
def method_missing(name, *args)
|
29
|
-
@rules ||= []
|
30
35
|
@rules << Palette::Rule.new(name.to_s, *args)
|
31
36
|
end
|
32
37
|
|
@@ -48,7 +53,6 @@ module Palette
|
|
48
53
|
|
49
54
|
%w(String Float).each do |constant|
|
50
55
|
define_method(constant) do |*args|
|
51
|
-
@rules ||= []
|
52
56
|
@rules << Palette::Rule.new(constant, *args)
|
53
57
|
end
|
54
58
|
end
|
@@ -76,7 +80,6 @@ module Palette
|
|
76
80
|
def link(*args)
|
77
81
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
78
82
|
|
79
|
-
@links ||= []
|
80
83
|
args.each do |arg|
|
81
84
|
@links << Link.new(arg, options[:to])
|
82
85
|
end
|
data/lib/palette/rule.rb
CHANGED
@@ -31,11 +31,13 @@ module Palette
|
|
31
31
|
output << %{ctermbg=#{sprintf("%-4s", color.to_cterm)}}
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
@gui ||= "none"
|
35
|
+
|
36
|
+
output << %{gui=#{gui.upcase}}
|
37
|
+
if gui =~ /italic/
|
38
|
+
output << %{cterm=NONE}
|
39
|
+
else
|
40
|
+
output << %{cterm=#{gui.upcase}}
|
39
41
|
end
|
40
42
|
|
41
43
|
output.join(" ").strip
|
data/lib/palette/version.rb
CHANGED
data/spec/rule_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Palette::Rule, "with a foreground" do
|
|
19
19
|
subject { Palette::Rule.new("Awesome", fg) }
|
20
20
|
|
21
21
|
it "highlights the correct colors" do
|
22
|
-
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm}"
|
22
|
+
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} gui=NONE cterm=NONE"
|
23
23
|
end
|
24
24
|
|
25
25
|
it "converts the correct colors" do
|
@@ -34,7 +34,7 @@ describe Palette::Rule, "with a foreground set to none" do
|
|
34
34
|
subject { Palette::Rule.new("Awesome", "none") }
|
35
35
|
|
36
36
|
it "highlights the correct colors" do
|
37
|
-
subject.to_s.should == "hi Awesome guifg=NONE ctermfg=NONE"
|
37
|
+
subject.to_s.should == "hi Awesome guifg=NONE ctermfg=NONE gui=NONE cterm=NONE"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,7 +43,7 @@ describe Palette::Rule, "with a foreground and background" do
|
|
43
43
|
subject { Palette::Rule.new("Awesome", fg, bg) }
|
44
44
|
|
45
45
|
it "highlights the correct colors" do
|
46
|
-
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
|
46
|
+
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm} gui=NONE cterm=NONE"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "converts the correct colors" do
|
@@ -59,7 +59,7 @@ describe Palette::Rule, "with a hash passed" do
|
|
59
59
|
subject { Palette::Rule.new("Awesome", :fg => fg, :bg => bg) }
|
60
60
|
|
61
61
|
it "highlights the correct colors" do
|
62
|
-
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm}"
|
62
|
+
subject.to_s.should == "hi Awesome guifg=##{hex} ctermfg=#{cterm} guibg=##{hex} ctermbg=#{cterm} gui=NONE cterm=NONE"
|
63
63
|
end
|
64
64
|
|
65
65
|
it "converts the correct colors" do
|
@@ -74,7 +74,7 @@ describe Palette::Rule, "with a gui" do
|
|
74
74
|
subject { Palette::Rule.new("Awesome", :gui => "bold") }
|
75
75
|
|
76
76
|
it "sets the gui correctly" do
|
77
|
-
subject.to_s.should == "hi Awesome gui=
|
77
|
+
subject.to_s.should == "hi Awesome gui=BOLD cterm=BOLD"
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -82,7 +82,7 @@ describe Palette::Rule, "with a gui as italic" do
|
|
82
82
|
subject { Palette::Rule.new("Awesome", :gui => "italic") }
|
83
83
|
|
84
84
|
it "sets the gui correctly" do
|
85
|
-
subject.to_s.should == "hi Awesome gui=
|
85
|
+
subject.to_s.should == "hi Awesome gui=ITALIC cterm=NONE"
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: palette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 19
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 0.0.6
|
5
|
+
version: 0.0.7
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Josh Clayton
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-09-03 00:00:00 -04:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - "="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 1
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 1
|
33
|
-
- 1
|
34
24
|
version: 3.1.1
|
35
25
|
type: :runtime
|
36
26
|
version_requirements: *id001
|
@@ -42,11 +32,6 @@ dependencies:
|
|
42
32
|
requirements:
|
43
33
|
- - "="
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 23
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 6
|
49
|
-
- 0
|
50
35
|
version: 2.6.0
|
51
36
|
type: :development
|
52
37
|
version_requirements: *id002
|
@@ -58,11 +43,6 @@ dependencies:
|
|
58
43
|
requirements:
|
59
44
|
- - "="
|
60
45
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 43
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 9
|
65
|
-
- 8
|
66
46
|
version: 0.9.8
|
67
47
|
type: :development
|
68
48
|
version_requirements: *id003
|
@@ -74,10 +54,6 @@ dependencies:
|
|
74
54
|
requirements:
|
75
55
|
- - "="
|
76
56
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 15
|
78
|
-
segments:
|
79
|
-
- 1
|
80
|
-
- 0
|
81
57
|
version: "1.0"
|
82
58
|
type: :development
|
83
59
|
version_requirements: *id004
|
@@ -89,11 +65,6 @@ dependencies:
|
|
89
65
|
requirements:
|
90
66
|
- - "="
|
91
67
|
- !ruby/object:Gem::Version
|
92
|
-
hash: 19
|
93
|
-
segments:
|
94
|
-
- 1
|
95
|
-
- 0
|
96
|
-
- 2
|
97
68
|
version: 1.0.2
|
98
69
|
type: :development
|
99
70
|
version_requirements: *id005
|
@@ -105,11 +76,6 @@ dependencies:
|
|
105
76
|
requirements:
|
106
77
|
- - "="
|
107
78
|
- !ruby/object:Gem::Version
|
108
|
-
hash: 5
|
109
|
-
segments:
|
110
|
-
- 0
|
111
|
-
- 4
|
112
|
-
- 5
|
113
79
|
version: 0.4.5
|
114
80
|
type: :development
|
115
81
|
version_requirements: *id006
|
@@ -158,18 +124,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
124
|
requirements:
|
159
125
|
- - ">="
|
160
126
|
- !ruby/object:Gem::Version
|
161
|
-
hash: 3
|
162
|
-
segments:
|
163
|
-
- 0
|
164
127
|
version: "0"
|
165
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
129
|
none: false
|
167
130
|
requirements:
|
168
131
|
- - ">="
|
169
132
|
- !ruby/object:Gem::Version
|
170
|
-
hash: 3
|
171
|
-
segments:
|
172
|
-
- 0
|
173
133
|
version: "0"
|
174
134
|
requirements: []
|
175
135
|
|