pry-theme 1.0.0 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/VERSION +1 -1
- data/lib/pry-theme/color.rb +3 -3
- data/lib/pry-theme/color_table.rb +2 -2
- data/spec/colors/color16_spec.rb +5 -5
- data/spec/colors/color256_spec.rb +28 -14
- data/spec/colors/color8_spec.rb +5 -5
- data/spec/theme_spec.rb +36 -36
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a1eb3f214ef45843bfac7d8bf137954708f6418
|
4
|
+
data.tar.gz: 195401625f2ac311d07a77fc3f94db9971d3138f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8920c63f7ffe04ce0ea6207a192d0d7c08cc7714e12044c73db5cc4d2c98fb98ac8ca8e51c60d8c83fe4dfae2a6e0f55f97bf229aaa0e77aed8affc107a659bb
|
7
|
+
data.tar.gz: 193ecb28c36838b75f66b2f25a29bcaec92b1784c6d9538de367ded42a7eee6f5ae52063be155679310371016d429a877b14858f455ecba505da3114c10b5f15
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
Pry Theme changelog
|
2
2
|
===================
|
3
3
|
|
4
|
+
### v1.0.1 (November 18, 2013)
|
5
|
+
|
6
|
+
* Fixed `pry-theme convert` and `pry-theme colors`
|
7
|
+
|
4
8
|
### v1.0.0 (November 13, 2013)
|
5
9
|
|
6
|
-
* **IMPORTANT**: This version is incompatible with CodeRay 1.0.9 and lower
|
10
|
+
* **IMPORTANT**: This version is incompatible with CodeRay 1.0.9 and lower
|
7
11
|
* Fixed CodeRay 1.1.0 support
|
8
12
|
|
9
13
|
### v0.2.0 (March 26, 2013)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/pry-theme/color.rb
CHANGED
@@ -336,9 +336,9 @@ module PryTheme
|
|
336
336
|
readable ? @readable_bg : layer_color(colors(:background)[@readable_bg])
|
337
337
|
end
|
338
338
|
|
339
|
-
def to_ansi
|
340
|
-
|
341
|
-
escape(
|
339
|
+
def to_ansi(inversion = false)
|
340
|
+
ansi = create_ansi_sequence(foreground, background)
|
341
|
+
escape(inversion ? ['7;', ansi].join('') : ansi)
|
342
342
|
end
|
343
343
|
|
344
344
|
private
|
@@ -15,8 +15,8 @@ module PryTheme
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def build_color_string(color, fg = nil)
|
18
|
-
"
|
19
|
-
[color.to_ansi, fg || color.foreground,
|
18
|
+
"%s%s\e[0m:%s%s\e[0m" %
|
19
|
+
[color.to_ansi(true), fg || color.foreground,
|
20
20
|
color.to_ansi, color.foreground(true)]
|
21
21
|
end
|
22
22
|
end
|
data/spec/colors/color16_spec.rb
CHANGED
@@ -7,17 +7,17 @@ describe PryTheme::Color16 do
|
|
7
7
|
it "can be set" do
|
8
8
|
color = Color16.new(:foreground => 'bright_red')
|
9
9
|
color.foreground(true).should == 'bright_red'
|
10
|
-
color.to_ansi.should ==
|
10
|
+
color.to_ansi.should == "\e[31;1m"
|
11
11
|
|
12
12
|
color = Color16.new(:foreground => 'red')
|
13
13
|
color.foreground(true).should == 'red'
|
14
|
-
color.to_ansi.should ==
|
14
|
+
color.to_ansi.should == "\e[31m"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "defaults to no colour at all" do
|
18
18
|
color = Color16.new
|
19
19
|
color.foreground(true).should == false
|
20
|
-
color.to_ansi.should ==
|
20
|
+
color.to_ansi.should == "\e[39;49m"
|
21
21
|
end
|
22
22
|
|
23
23
|
it "raises error on invalid value" do
|
@@ -31,7 +31,7 @@ describe PryTheme::Color16 do
|
|
31
31
|
it "can be set" do
|
32
32
|
color = Color16.new(:background => 'blue')
|
33
33
|
color.background(true).should == 'blue'
|
34
|
-
color.to_ansi.should ==
|
34
|
+
color.to_ansi.should == "\e[44m"
|
35
35
|
end
|
36
36
|
|
37
37
|
it "raises error on invalid value" do
|
@@ -48,7 +48,7 @@ describe PryTheme::Color16 do
|
|
48
48
|
:background => 'bright_white')
|
49
49
|
color.foreground(true).should == 'bright_yellow'
|
50
50
|
color.background(true).should == 'bright_white'
|
51
|
-
color.to_ansi.should ==
|
51
|
+
color.to_ansi.should == "\e[33;1;47m"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -7,13 +7,13 @@ describe PryTheme::Color256 do
|
|
7
7
|
it "can be set" do
|
8
8
|
color = Color256.new(:foreground => 'bright_violet')
|
9
9
|
color.foreground(true).should == 'bright_violet'
|
10
|
-
color.to_ansi.should ==
|
10
|
+
color.to_ansi.should == "\e[38;5;128m"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "defaults to no colour at all" do
|
14
14
|
color = Color256.new
|
15
15
|
color.foreground(true).should == false
|
16
|
-
color.to_ansi.should ==
|
16
|
+
color.to_ansi.should == "\e[0m"
|
17
17
|
end
|
18
18
|
|
19
19
|
it "raises error on invalid value" do
|
@@ -28,7 +28,7 @@ describe PryTheme::Color256 do
|
|
28
28
|
color.bold?.should == false
|
29
29
|
color.underline?.should == false
|
30
30
|
color.italic?.should == false
|
31
|
-
color.to_ansi.should ==
|
31
|
+
color.to_ansi.should == "\e[38;5;128m"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "uses bold" do
|
@@ -36,7 +36,7 @@ describe PryTheme::Color256 do
|
|
36
36
|
color.bold?.should == true
|
37
37
|
color.underline?.should == false
|
38
38
|
color.italic?.should == false
|
39
|
-
color.to_ansi.should ==
|
39
|
+
color.to_ansi.should == "\e[38;5;178;1m"
|
40
40
|
end
|
41
41
|
|
42
42
|
it "uses underline" do
|
@@ -44,7 +44,7 @@ describe PryTheme::Color256 do
|
|
44
44
|
color.bold?.should == false
|
45
45
|
color.underline?.should == true
|
46
46
|
color.italic?.should == false
|
47
|
-
color.to_ansi.should ==
|
47
|
+
color.to_ansi.should == "\e[38;5;62;4m"
|
48
48
|
end
|
49
49
|
|
50
50
|
it "uses italic" do
|
@@ -52,7 +52,7 @@ describe PryTheme::Color256 do
|
|
52
52
|
color.bold?.should == false
|
53
53
|
color.underline?.should == false
|
54
54
|
color.italic?.should == true
|
55
|
-
color.to_ansi.should ==
|
55
|
+
color.to_ansi.should == "\e[38;5;161;3m"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "combines everything" do
|
@@ -64,7 +64,7 @@ describe PryTheme::Color256 do
|
|
64
64
|
color.bold?.should == true
|
65
65
|
color.underline?.should == true
|
66
66
|
color.italic?.should == true
|
67
|
-
color.to_ansi.should ==
|
67
|
+
color.to_ansi.should == "\e[38;5;160;1;3;4m"
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "with defaults" do
|
@@ -73,7 +73,7 @@ describe PryTheme::Color256 do
|
|
73
73
|
color.bold?.should == false
|
74
74
|
color.underline?.should == false
|
75
75
|
color.italic?.should == false
|
76
|
-
color.to_ansi.should ==
|
76
|
+
color.to_ansi.should == "\e[0m"
|
77
77
|
end
|
78
78
|
|
79
79
|
it "can be used without foreground" do
|
@@ -81,7 +81,7 @@ describe PryTheme::Color256 do
|
|
81
81
|
color.bold?.should == true
|
82
82
|
color.underline?.should == false
|
83
83
|
color.italic?.should == false
|
84
|
-
color.to_ansi.should ==
|
84
|
+
color.to_ansi.should == "\e[48;5;235;1m"
|
85
85
|
end
|
86
86
|
|
87
87
|
it "can be used with the default colour" do
|
@@ -89,7 +89,7 @@ describe PryTheme::Color256 do
|
|
89
89
|
color.bold?.should == true
|
90
90
|
color.underline?.should == true
|
91
91
|
color.italic?.should == true
|
92
|
-
color.to_ansi.should ==
|
92
|
+
color.to_ansi.should == "\e[1;3;4m"
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -99,13 +99,13 @@ describe PryTheme::Color256 do
|
|
99
99
|
it "can be set" do
|
100
100
|
color = Color256.new(:background => 'bright_violet')
|
101
101
|
color.background(true).should == 'bright_violet'
|
102
|
-
color.to_ansi.should ==
|
102
|
+
color.to_ansi.should == "\e[48;5;128m"
|
103
103
|
end
|
104
104
|
|
105
105
|
it "defaults to no colour at all" do
|
106
106
|
color = Color256.new
|
107
107
|
color.background(true).should == false
|
108
|
-
color.to_ansi.should ==
|
108
|
+
color.to_ansi.should == "\e[0m"
|
109
109
|
end
|
110
110
|
|
111
111
|
it "raises error on invalid value" do
|
@@ -122,7 +122,7 @@ describe PryTheme::Color256 do
|
|
122
122
|
:foreground => 'pale_brown')
|
123
123
|
color.foreground(true).should == 'pale_brown'
|
124
124
|
color.background(true).should == 'red_violet01'
|
125
|
-
color.to_ansi.should ==
|
125
|
+
color.to_ansi.should == "\e[38;5;137;48;5;126m"
|
126
126
|
end
|
127
127
|
|
128
128
|
it "can be set with effects" do
|
@@ -132,7 +132,7 @@ describe PryTheme::Color256 do
|
|
132
132
|
:italic => true,
|
133
133
|
:bold => true,
|
134
134
|
:underline => true)
|
135
|
-
color.to_ansi.should ==
|
135
|
+
color.to_ansi.should == "\e[38;5;137;1;3;4;48;5;126m"
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -320,4 +320,18 @@ describe PryTheme::Color256 do
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
+
describe "#to_ansi" do
|
324
|
+
before do
|
325
|
+
@color = Color256.new(:from => :term, :background => 84)
|
326
|
+
end
|
327
|
+
|
328
|
+
it "converts a colour to an ANSI sequence" do
|
329
|
+
@color.to_ansi.should == "\e[48;5;84m"
|
330
|
+
end
|
331
|
+
|
332
|
+
it "given `true` converts a colour to an inverted ANSI sequence" do
|
333
|
+
@color.to_ansi(true).should == "\e[7;48;5;84m"
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
323
337
|
end
|
data/spec/colors/color8_spec.rb
CHANGED
@@ -7,13 +7,13 @@ describe PryTheme::Color8 do
|
|
7
7
|
it "can be set" do
|
8
8
|
color = Color8.new(:foreground => 'red')
|
9
9
|
color.foreground(true).should == 'red'
|
10
|
-
color.to_ansi.should ==
|
10
|
+
color.to_ansi.should == "\e[31m"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "defaults to no colour at all" do
|
14
14
|
color = Color8.new
|
15
15
|
color.foreground(true).should == false
|
16
|
-
color.to_ansi.should ==
|
16
|
+
color.to_ansi.should == "\e[39;49m"
|
17
17
|
end
|
18
18
|
|
19
19
|
it "raises error on invalid value" do
|
@@ -27,13 +27,13 @@ describe PryTheme::Color8 do
|
|
27
27
|
it "can be set" do
|
28
28
|
color = Color8.new(:background => 'blue')
|
29
29
|
color.background(true).should == 'blue'
|
30
|
-
color.to_ansi.should ==
|
30
|
+
color.to_ansi.should == "\e[44m"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "defaults to no colour at all" do
|
34
34
|
color = Color8.new
|
35
35
|
color.background(true).should == false
|
36
|
-
color.to_ansi.should ==
|
36
|
+
color.to_ansi.should == "\e[39;49m"
|
37
37
|
end
|
38
38
|
|
39
39
|
it "raises error on invalid value" do
|
@@ -48,7 +48,7 @@ describe PryTheme::Color8 do
|
|
48
48
|
color = Color8.new(:foreground => 'green', :background => 'red')
|
49
49
|
color.foreground(true).should == 'green'
|
50
50
|
color.background(true).should == 'red'
|
51
|
-
color.to_ansi.should ==
|
51
|
+
color.to_ansi.should == "\e[32;41m"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/spec/theme_spec.rb
CHANGED
@@ -128,7 +128,7 @@ describe PryTheme::Theme do
|
|
128
128
|
|
129
129
|
it "defaults to proper colours" do
|
130
130
|
theme = PryTheme.create(:color_model => 8){ define_theme{} }
|
131
|
-
theme.definition.integer.to_ansi.should ==
|
131
|
+
theme.definition.integer.to_ansi.should == "\e[39;49m"
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -156,7 +156,7 @@ describe PryTheme::Theme do
|
|
156
156
|
|
157
157
|
it "defaults to proper colours" do
|
158
158
|
theme = PryTheme.create(:color_model => 16){ define_theme{} }
|
159
|
-
theme.definition.integer.to_ansi.should ==
|
159
|
+
theme.definition.integer.to_ansi.should == "\e[39;49m"
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -184,7 +184,7 @@ describe PryTheme::Theme do
|
|
184
184
|
|
185
185
|
it "defaults to proper colours" do
|
186
186
|
theme = PryTheme.create(:color_model => 256){ define_theme{} }
|
187
|
-
theme.definition.integer.to_ansi.should ==
|
187
|
+
theme.definition.integer.to_ansi.should == "\e[0m"
|
188
188
|
end
|
189
189
|
|
190
190
|
describe "effects" do
|
@@ -297,10 +297,10 @@ describe PryTheme::Theme do
|
|
297
297
|
string{ self_ 'green'; delimiter 'black' } } }
|
298
298
|
theme.definition.regexp.self_.foreground(true).should == 'blue'
|
299
299
|
theme.definition.string.self_.foreground(true).should == 'green'
|
300
|
-
theme.definition.regexp.modifier.to_ansi.should ==
|
300
|
+
theme.definition.regexp.modifier.to_ansi.should == "\e[39;49m"
|
301
301
|
theme.definition.string.delimiter.foreground(true).should == 'black'
|
302
|
-
theme.definition.regexp.delimiter.to_ansi.should ==
|
303
|
-
theme.definition.shell.delimiter.to_ansi.should ==
|
302
|
+
theme.definition.regexp.delimiter.to_ansi.should == "\e[39;49m"
|
303
|
+
theme.definition.shell.delimiter.to_ansi.should == "\e[39;49m"
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
@@ -433,41 +433,41 @@ describe PryTheme::Theme do
|
|
433
433
|
describe "#to_coderay" do
|
434
434
|
before do
|
435
435
|
@coderay_hash = {
|
436
|
-
:class =>
|
437
|
-
:class_variable =>
|
438
|
-
:comment =>
|
439
|
-
:constant =>
|
440
|
-
:error =>
|
441
|
-
:float =>
|
442
|
-
:global_variable =>
|
443
|
-
:integer =>
|
444
|
-
:inline_delimiter =>
|
445
|
-
:instance_variable =>
|
446
|
-
:keyword =>
|
447
|
-
:method =>
|
448
|
-
:predefined_constant =>
|
449
|
-
:symbol =>
|
436
|
+
:class => "\e[48;5;118m",
|
437
|
+
:class_variable => "\e[0m",
|
438
|
+
:comment => "\e[0m",
|
439
|
+
:constant => "\e[0m",
|
440
|
+
:error => "\e[0m",
|
441
|
+
:float => "\e[0m",
|
442
|
+
:global_variable => "\e[38;5;81;4m",
|
443
|
+
:integer => "\e[38;5;64;48;5;208m",
|
444
|
+
:inline_delimiter => "\e[0m",
|
445
|
+
:instance_variable => "\e[0m",
|
446
|
+
:keyword => "\e[0m",
|
447
|
+
:method => "\e[0m",
|
448
|
+
:predefined_constant => "\e[0m",
|
449
|
+
:symbol => "\e[0m",
|
450
450
|
:regexp => {
|
451
|
-
:self =>
|
452
|
-
:char =>
|
453
|
-
:content =>
|
454
|
-
:delimiter =>
|
455
|
-
:modifier =>
|
456
|
-
:escape =>
|
451
|
+
:self => "\e[0m",
|
452
|
+
:char => "\e[0m",
|
453
|
+
:content => "\e[0m",
|
454
|
+
:delimiter => "\e[0m",
|
455
|
+
:modifier => "\e[38;5;148m",
|
456
|
+
:escape => "\e[0m",
|
457
457
|
},
|
458
458
|
:shell => {
|
459
|
-
:self =>
|
460
|
-
:char =>
|
461
|
-
:content =>
|
462
|
-
:delimiter =>
|
463
|
-
:escape =>
|
459
|
+
:self => "\e[0m",
|
460
|
+
:char => "\e[0m",
|
461
|
+
:content => "\e[0m",
|
462
|
+
:delimiter => "\e[0m",
|
463
|
+
:escape => "\e[0m",
|
464
464
|
},
|
465
465
|
:string => {
|
466
|
-
:self =>
|
467
|
-
:char =>
|
468
|
-
:content =>
|
469
|
-
:delimiter =>
|
470
|
-
:escape =>
|
466
|
+
:self => "\e[38;5;186m",
|
467
|
+
:char => "\e[0m",
|
468
|
+
:content => "\e[0m",
|
469
|
+
:delimiter => "\e[0m",
|
470
|
+
:escape => "\e[0m",
|
471
471
|
}
|
472
472
|
}
|
473
473
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyrylo Silin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|