paint 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.rdoc +3 -0
- data/MIT-LICENSE.txt +1 -1
- data/README.rdoc +7 -12
- data/Rakefile +1 -60
- data/lib/paint.rb +2 -2
- data/lib/paint/version.rb +1 -1
- data/paint.gemspec +6 -2
- metadata +67 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63ed011bd7330b8eeb09f86bf322dd6264fb35eb
|
4
|
+
data.tar.gz: 8263d88278c4de5090b21c30fb97ab6e9351979c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d6c016324fedf50b5a45955fbd899eb7f18c3f198d93f949b8de0c00543d9646d78e6f763c584b6b0f5e73b1ecfee08615bb4bf16be1f5f407f3e225d7e400
|
7
|
+
data.tar.gz: 9ee54e34fb37fe00208432cc33a3c3332f3ec2c9708d5f19992286136774c86e5a118cdfc0ec3deddbc704e305b2ec8f84e4b676ee9814e1496f9d7bbb1259ad
|
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -4,10 +4,10 @@ Paint manages terminal colors and effects for you. It combines the strengths of
|
|
4
4
|
|
5
5
|
== Features
|
6
6
|
* No string extensions (suitable for library development)
|
7
|
+
* Simple API
|
8
|
+
* Faster than other terminal color gems ({as of October 2015}[https://gist.github.com/janlelis/91413b9295c81ee873dc])
|
7
9
|
* Supports setting 256 colors (for capable terminals)
|
8
|
-
* Supports setting any effects
|
9
|
-
* Simple to use
|
10
|
-
* Faster than most similar gems due to caching
|
10
|
+
* Supports setting any terminal effects
|
11
11
|
* Fall-back modes for non-256-color terminals (<tt>Paint.mode</tt>), supported modes:
|
12
12
|
* 256 colors
|
13
13
|
* 16 colors (only ansi colors, combined with bright effect)
|
@@ -26,7 +26,7 @@ In Ruby do:
|
|
26
26
|
require 'paint'
|
27
27
|
|
28
28
|
== Usage
|
29
|
-
The only method you need to know
|
29
|
+
The only method you need to know is: <tt>Paint.[]</tt>
|
30
30
|
|
31
31
|
The first argument given to <tt>Paint.[]</tt> is the string to colorize (if the object is not a string, <tt>to_s</tt> will be called on it). The other arguments describe how to modify/colorize the string. Let's learn by example:
|
32
32
|
|
@@ -106,8 +106,7 @@ You can choose between four ways to use <tt>Paint.[]</tt> by setting <tt>Paint.m
|
|
106
106
|
|
107
107
|
Paint tries to automatically detect the proper value, please open an issue if <tt>Paint.detect_mode</tt> yields a wrong value for you.
|
108
108
|
|
109
|
-
== Random ANSI
|
110
|
-
|
109
|
+
== Random ANSI Colors
|
111
110
|
With 1.0, the :random feature was removed, because it interfered with the caching mechanism. If you still need it, you will have to workaround by generating random colors yourself, before passing them into the Paint method:
|
112
111
|
|
113
112
|
Paint['Ruby', Paint.random] # get one of eight random ansi foreground colors
|
@@ -128,10 +127,6 @@ There is an extension gem available that allows you to define custom color short
|
|
128
127
|
|
129
128
|
== J-_-L
|
130
129
|
|
131
|
-
Copyright (c) 2011-
|
130
|
+
Copyright (c) 2011-2016 Jan Lelis <http://janlelis.com>, released under the MIT license.
|
132
131
|
|
133
|
-
Mainly influenced by rainbow[https://github.com/sickill/rainbow] and {term-ansicolor}[https://github.com/flori/term-ansicolor].
|
134
|
-
* {CyberShadow}[https://github.com/CyberShadow]
|
135
|
-
* {korun}[https://github.com/korun]
|
136
|
-
* {mhaylock}[https://github.com/mhaylock]
|
137
|
-
* {korny}[https://github.com/rubychan]
|
132
|
+
Mainly influenced by rainbow[https://github.com/sickill/rainbow] and {term-ansicolor}[https://github.com/flori/term-ansicolor]. Also see the list of contributors[https://github.com/janlelis/paint/contributors]
|
data/Rakefile
CHANGED
@@ -41,64 +41,5 @@ end
|
|
41
41
|
|
42
42
|
desc "Run a Benchmark"
|
43
43
|
task :benchmark do
|
44
|
-
|
45
|
-
require 'term/ansicolor'
|
46
|
-
class String
|
47
|
-
include Term::ANSIColor
|
48
|
-
end
|
49
|
-
|
50
|
-
require 'rainbow'
|
51
|
-
require_relative 'lib/paint'
|
52
|
-
|
53
|
-
n = 100_000
|
54
|
-
colors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan]
|
55
|
-
def colors.next
|
56
|
-
@index ||= 0
|
57
|
-
at((@index += 1) % size)
|
58
|
-
end
|
59
|
-
Benchmark.bmbm 30 do |results|
|
60
|
-
string = 'Ruby is awesome!'
|
61
|
-
|
62
|
-
results.report 'cycle' do
|
63
|
-
n.times do
|
64
|
-
colors.next
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
results.report 'paint' do
|
69
|
-
n.times do
|
70
|
-
Paint[string, colors.next]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
results.report 'term-ansicolor' do
|
75
|
-
n.times do
|
76
|
-
string.send(colors.next)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
results.report 'rainbow' do
|
81
|
-
n.times do
|
82
|
-
Rainbow(string).color(colors.next)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
results.report 'paint with background' do
|
87
|
-
n.times do
|
88
|
-
Paint[string, colors.next, colors.next]
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
results.report 'term-ansicolor with background' do
|
93
|
-
n.times do
|
94
|
-
string.send(colors.next).send("on_#{colors.next}")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
results.report 'rainbow with background' do
|
99
|
-
n.times do
|
100
|
-
Rainbow(string).color(colors.next).background(colors.next)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
44
|
+
ruby 'benchmark.rb'
|
104
45
|
end
|
data/lib/paint.rb
CHANGED
@@ -173,8 +173,8 @@ module Paint
|
|
173
173
|
end
|
174
174
|
|
175
175
|
# Creates 256-compatible color from a html-like color string
|
176
|
-
def hex(
|
177
|
-
string.tr
|
176
|
+
def hex(source, background = false)
|
177
|
+
string = source.tr '#',''
|
178
178
|
color_code = if string.size == 6
|
179
179
|
string.each_char.each_slice(2).map{ |hex_color| hex_color.join.to_i(16) }
|
180
180
|
else
|
data/lib/paint/version.rb
CHANGED
data/paint.gemspec
CHANGED
@@ -34,6 +34,10 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.requirements = ['Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)']
|
35
35
|
s.add_development_dependency 'rspec', '~> 3.2'
|
36
36
|
s.add_development_dependency 'rake', '~> 10.4'
|
37
|
-
s.add_development_dependency '
|
38
|
-
s.add_development_dependency '
|
37
|
+
s.add_development_dependency 'benchmark-ips', '~> 2.3'
|
38
|
+
s.add_development_dependency 'rainbow', '~> 2.0'
|
39
|
+
s.add_development_dependency 'term-ansicolor', '~> 1.3'
|
40
|
+
s.add_development_dependency 'ansi', '~> 1.5'
|
41
|
+
s.add_development_dependency 'hansi', '~> 0.1'
|
42
|
+
s.add_development_dependency 'pastel', '~> 0.5'
|
39
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paint
|
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
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,34 +38,90 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: benchmark-ips
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rainbow
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: '2.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: term-ansicolor
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ansi
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.5'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: hansi
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
60
102
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
103
|
+
version: '0.1'
|
62
104
|
type: :development
|
63
105
|
prerelease: false
|
64
106
|
version_requirements: !ruby/object:Gem::Requirement
|
65
107
|
requirements:
|
66
|
-
- - "
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pastel
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.5'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
67
123
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
124
|
+
version: '0.5'
|
69
125
|
description: 'Terminal painter: No string extensions / 256 color support / effect
|
70
126
|
support. Usage: Paint[''string'', :red, :bright]'
|
71
127
|
email: mail@janlelis.de
|
@@ -110,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
166
|
requirements:
|
111
167
|
- 'Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)'
|
112
168
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.5.1
|
114
170
|
signing_key:
|
115
171
|
specification_version: 4
|
116
172
|
summary: Terminal painter!
|