paint 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +3 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +16 -12
- data/Rakefile +2 -1
- data/lib/paint/util.rb +2 -0
- data/lib/paint/version.rb +1 -1
- data/spec/paint_methods_spec.rb +3 -1
- data/spec/paint_mode_spec.rb +2 -0
- data/spec/paint_shortcuts_spec.rb +2 -0
- data/spec/paint_spec.rb +2 -0
- metadata +44 -18
data/CHANGELOG.rdoc
CHANGED
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Paint manages terminal colors and effects for you. It combines the strengths of gems like term-ansicolor or rainbow into a simple to use
|
1
|
+
Paint manages terminal colors and effects for you. It combines the strengths of gems like term-ansicolor or rainbow into a simple to use, but still flexible colorizer with no core extensions by default.
|
2
2
|
|
3
3
|
{Travis}[http://travis-ci.org/janlelis/paint]: http://travis-ci.org/janlelis/paint.png
|
4
4
|
|
@@ -49,6 +49,9 @@ If you pass multiple colors, the first one is taken as foreground color and the
|
|
49
49
|
|
50
50
|
To see more examples, checkout the specs.
|
51
51
|
|
52
|
+
== Windows Support
|
53
|
+
To enjoy colorful terminals on Windows OS, you can use {ansicon}[https://github.com/adoxa/ansicon] or {ConEmu}[http://code.google.com/p/conemu-maximus5/].
|
54
|
+
|
52
55
|
== More details about terminal colors and effects
|
53
56
|
|
54
57
|
Terminal colors/effects are set by {ansi escape sequences}[http://en.wikipedia.org/wiki/ANSI_escape_code]. These are strings that look like this: <tt>\e[X;X;X;X;X]m</tt> where X are integers with some meaning. For example, 0 means reset, 31 means red foreground and 41 red background. When you tell Paint to use one of the eight ansi base colors as foreground color, it just inserts a number between 30 and 37 in the sequence. The following colors are available:
|
@@ -107,7 +110,7 @@ You can choose between three ways to use <tt>Paint.[]</tt> by setting <tt>Paint.
|
|
107
110
|
|
108
111
|
Paint tries to detect automatically the proper value, but this is still experimental. Please open an issue if <tt>Paint.detect_mode</tt> yields a wrong value for you.
|
109
112
|
|
110
|
-
== Shortcuts
|
113
|
+
== Advanced Usage: Shortcuts
|
111
114
|
|
112
115
|
Now for the fancy part: Color shortcuts for your gems and scripts! Note: You don't have to use them (and only stick to <tt>Paint.[]</tt>) ;)
|
113
116
|
|
@@ -119,16 +122,14 @@ It's easy: Just setup a hash of symbol keys and escape string values at: <tt>Pai
|
|
119
122
|
:title => Paint.color(:underline),
|
120
123
|
}
|
121
124
|
|
122
|
-
The methods become rubymagically available in a <tt>Paint</tt> child model
|
125
|
+
The methods become "rubymagically" available in a <tt>Paint</tt> child model:
|
123
126
|
|
124
127
|
Paint::Example.red 'Ruby' # => "\e[31;1mRuby\e[0m"
|
125
128
|
Paint::Example.white # => "\e[37m"
|
126
129
|
|
127
130
|
As you can see, the helper methods look useful and can take either one (wrap string) or none (only color) arguments ...but they aren't really <em>short</em> yet.
|
128
131
|
|
129
|
-
|
130
|
-
|
131
|
-
Just include them:
|
132
|
+
Fortunately, you can include them:
|
132
133
|
|
133
134
|
include Paint::Example
|
134
135
|
red # => "\e[31;1m"
|
@@ -142,7 +143,7 @@ Furthermore, there are two variations of this approach:
|
|
142
143
|
"Ruby".title # => "\e[4mRuby\e[0m"
|
143
144
|
5.red # => "\e[31;1m5\e[0m"
|
144
145
|
|
145
|
-
In this case, <tt>self</tt> will be converted to a string and wrapped with the specific color code. Note, that the helper methods doesn't take any arguments when using this method.
|
146
|
+
In this case, <tt>self</tt> will be converted to a string and wrapped with the specific color code. Note, that the helper methods doesn't take any arguments when using this inclusion method.
|
146
147
|
|
147
148
|
The third way allows you to get a single color helper method to avoid cluttering namespaces:
|
148
149
|
|
@@ -151,27 +152,30 @@ The third way allows you to get a single color helper method to avoid cluttering
|
|
151
152
|
|
152
153
|
=== Utilities
|
153
154
|
|
154
|
-
There are some
|
155
|
+
There are some supporting methods available. You can get a <tt>p</tt> like alternative for calling <tt>puts Paint.[]</tt>:
|
155
156
|
|
156
157
|
require 'paint/pa'
|
157
158
|
pa "Ruby", :red, :underline # same as puts Paint["Ruby", :red, :underline]
|
158
159
|
|
159
|
-
Another
|
160
|
+
Another helper method is <tt>Paint.unpaint</tt>, which removes any ansi colors:
|
160
161
|
|
161
162
|
Paint.unpaint( Paint['J-_-L', :red, :bright] ).should == 'J-_-L'
|
162
163
|
|
163
164
|
== Todos
|
164
165
|
=== Maybe
|
166
|
+
|
165
167
|
* 24-bit color support (konsole), see http://www.reddit.com/r/programming/comments/6gxnp/making_the_most_of_colour_on_text_consoles/c03t8k8
|
168
|
+
* Complete the few missing specs
|
166
169
|
|
167
170
|
== Credits
|
168
171
|
|
169
|
-
|
172
|
+
Copyright (c) 2011-2012 Jan Lelis, http://rbjl.net, released under the MIT license.
|
170
173
|
|
171
|
-
|
174
|
+
Mainly influenced by rainbow[https://github.com/sickill/rainbow] and {term-ansicolor}[https://github.com/flori/term-ansicolor].
|
172
175
|
|
173
176
|
Contributions[https://github.com/janlelis/paint/contributors] by and thanks to:
|
174
177
|
* {murphy}[https://github.com/rubychan]
|
178
|
+
* {CyberShadow}[https://github.com/CyberShadow]
|
175
179
|
|
176
|
-
J-_-L
|
180
|
+
== J-_-L
|
177
181
|
|
data/Rakefile
CHANGED
data/lib/paint/util.rb
CHANGED
data/lib/paint/version.rb
CHANGED
data/spec/paint_methods_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
1
3
|
describe 'Paint.color' do
|
2
4
|
it 'only returns a the color escape sequnce and is directly used by Paint.[] with all paramenters except the first; see there fore specs' do end
|
3
5
|
end
|
@@ -85,5 +87,5 @@ describe 'Paint.rainbow' do
|
|
85
87
|
end
|
86
88
|
|
87
89
|
describe 'Paint.update_rgb_colors' do
|
88
|
-
it 'updates the Paint::RGB_COLORS hash using rgb.txt (takes path to it as argument' do end
|
90
|
+
it 'updates the Paint::RGB_COLORS hash using rgb.txt (takes path to it as argument)' do end
|
89
91
|
end
|
data/spec/paint_mode_spec.rb
CHANGED
data/spec/paint_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec-core
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rainbow
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: term-ansicolor
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,7 +85,12 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
description: ! 'Terminal painter / no string extensions / 256 color support / effect
|
70
95
|
support / define custom shortcuts / basic usage: Paint[''string'', :red, :bright]'
|
71
96
|
email: mail@janlelis.de
|
@@ -75,21 +100,21 @@ extra_rdoc_files:
|
|
75
100
|
- README.rdoc
|
76
101
|
- LICENSE.txt
|
77
102
|
files:
|
78
|
-
- lib/paint.rb
|
79
|
-
- lib/paint/pa.rb
|
80
|
-
- lib/paint/shortcuts.rb
|
81
103
|
- lib/paint/rgb_colors_ansi.rb
|
104
|
+
- lib/paint/pa.rb
|
82
105
|
- lib/paint/version.rb
|
83
106
|
- lib/paint/rgb_colors.rb
|
107
|
+
- lib/paint/shortcuts.rb
|
84
108
|
- lib/paint/util.rb
|
109
|
+
- lib/paint.rb
|
85
110
|
- spec/spec_helper.rb
|
111
|
+
- spec/paint_spec.rb
|
86
112
|
- spec/paint_shortcuts_spec.rb
|
87
113
|
- spec/paint_mode_spec.rb
|
88
114
|
- spec/paint_methods_spec.rb
|
89
|
-
- spec/paint_spec.rb
|
90
115
|
- LICENSE.txt
|
91
|
-
- README.rdoc
|
92
116
|
- CHANGELOG.rdoc
|
117
|
+
- README.rdoc
|
93
118
|
- Rakefile
|
94
119
|
- paint.gemspec
|
95
120
|
- .gemtest
|
@@ -116,8 +141,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
141
|
version: '0'
|
117
142
|
requirements: []
|
118
143
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.8.
|
144
|
+
rubygems_version: 1.8.23
|
120
145
|
signing_key:
|
121
146
|
specification_version: 3
|
122
147
|
summary: Terminal painter!
|
123
148
|
test_files: []
|
149
|
+
has_rdoc:
|