paint 2.0.2 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec3dd2072102f8ebdfe49f0520b5d6096dc91541301690d04607a0df83586890
4
- data.tar.gz: 17d070ed26e8c27466117331bb6100df05aa3bb010fa0d89ae6cef98c88a8ac3
3
+ metadata.gz: 135bf13e5c9d57769e3e312c0dd5baa485a42e493b70d1c8a1eda802af1d78b2
4
+ data.tar.gz: 49651386bc399d9156936fabab7a046e311812a1ab14ecd682ca6d0e61f83caf
5
5
  SHA512:
6
- metadata.gz: 79b1b15e9ce5ff5a59f88c878f20c43630e9eb03832e3fb45f2ac3bde16ee4efc36427d39b043adc65d1d7ad97839ed9e16d12fc8e701deb2e5cb721c2f7b7ea
7
- data.tar.gz: b1059a3b96fc5248cfdd23b939c062bbea838ec48f09db7d5c2e3af6578be02060629e862572953d6b951b424bb47e6d8c3c553cd427ce1abf7416eb0f3e9ba5
6
+ metadata.gz: 28b1dff99750f9625c3d2d40b7521911840192483779fd0b7798fda970e8b6ce1de471e6cc6288d6053bddd9fb81b6a5a999d0d82b5bdb3de53f48dbb7dd9060
7
+ data.tar.gz: 6e667bd06608d7a2036369b21d73cc712467fb71f6a8c44e133f68b4ebe31b7a21cf3364ba72342e11fbe91a735f63cc7fcb62d825f696fad48643d07b53f6e5
@@ -2,20 +2,26 @@ sudo: false
2
2
  language: ruby
3
3
 
4
4
  rvm:
5
- - 2.5.0
6
- - 2.4.3
7
- - 2.3.6
5
+ - 2.7
6
+ - 2.6
7
+ - 2.5
8
+ - 2.4
9
+ - 2.3
8
10
  - 2.2
9
11
  - 2.1
10
12
  - 2.0
11
13
  - 1.9.3
12
14
  - ruby-head
13
15
  - jruby-head
14
- - jruby-9.1.15.0
16
+ - jruby-9.2.9.0
17
+ - truffleruby
15
18
 
16
19
  matrix:
17
20
  allow_failures:
18
21
  - rvm: jruby-head
22
+ - rvm: 2.3
23
+ - rvm: 2.2
19
24
  - rvm: 2.1
20
25
  - rvm: 2.0
21
26
  - rvm: 1.9.3
27
+ - rvm: truffleruby
@@ -1,5 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 2.2.1
4
+
5
+ * Explicitly set mac's Terminal.app to 256 colors only, fixes #28
6
+
7
+ ### 2.2.0
8
+
9
+ * Support NO_COLOR environment variable, implements #26 (see no-color.org)
10
+
11
+ ### 2.1.1
12
+
13
+ * Blacklist True Color support for urxvt, fixes #25
14
+
15
+ ### 2.1.0
16
+
17
+ * Set True Color as default mode on more terminals, patch by @smoochbot
18
+
19
+ ### 2.0.3
20
+
21
+ * Add `gray` alias for `white` color, patch by @AlexWayfer
22
+
3
23
  ### 2.0.2
4
24
 
5
25
  * Remove `gunzip` deprecation warning
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2011-2016 Jan Lelis
3
+ Copyright (c) 2011-2020 Jan Lelis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,12 +1,16 @@
1
- # Ruby Paint [<img src="https://badge.fury.io/rb/paint.svg" />](http://badge.fury.io/rb/paint) [<img src="https://travis-ci.org/janlelis/paint.svg" />](https://travis-ci.org/janlelis/paint)
1
+ # Ruby Paint [<img src="https://badge.fury.io/rb/paint.svg" />](https://badge.fury.io/rb/paint) [<img src="https://travis-ci.org/janlelis/paint.svg" />](https://travis-ci.org/janlelis/paint)
2
2
 
3
3
  Paint creates terminal colors and effects for you. It combines the strengths of **term-ansicolor**, **rainbow**, and similar projects into a simple to use, however still flexible terminal colors gem with no core extensions by default.
4
4
 
5
+ Supported Rubies: **2.7**, **2.6**, **2.5**
6
+
7
+ Unsupported, but might still work: **2.4**, **2.3**, **2.2**, **2.1**, **2.0**, **1.9**
8
+
5
9
  ## Features
6
10
 
7
11
  * No string extensions (suitable for library development)
8
12
  * Simple API
9
- * Faster than other terminal color gems ([as of December 2016](https://gist.github.com/janlelis/91413b9295c81ee873dc))
13
+ * Faster than other terminal color gems ([as of January 2020](https://gist.github.com/janlelis/91413b9295c81ee873dc))
10
14
  * Supports *true color* or 256 colors (for capable terminals)
11
15
  * Allows you to set any terminal effects
12
16
  * `Paint.mode`: Fall-back modes for terminals with less colors, supported modes:
@@ -23,14 +27,6 @@ Starting with **Paint 2.0**, *true color* mode is the new default mode, since mo
23
27
  - Manually set `Paint.mode = 256` at the beginning of your code
24
28
  - Please [open a new issue](https://github.com/janlelis/paint/issues/new) so we can figure out how to blacklist the terminal used
25
29
 
26
- ## Supported Rubies
27
-
28
- * **2.5**, **2.4**, **2.3**, **2.2**
29
-
30
- Unsupported, but might still work:
31
-
32
- * **2.1**, **2.0**, **1.9**
33
-
34
30
  ## Setup
35
31
 
36
32
  Add to `Gemfile`:
@@ -79,7 +75,7 @@ When you pass multiple colors, the first one is taken as foreground color and th
79
75
 
80
76
  ## Windows Support
81
77
 
82
- For ANSI support in Windows OS, you can use [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](http://code.google.com/p/conemu-maximus5/).
78
+ For ANSI support in Windows OS, you can use [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](https://conemu.github.io/) or WSL(https://docs.microsoft.com/en-us/windows/wsl/install-win10).
83
79
 
84
80
  ## `Paint.mode`
85
81
 
@@ -93,9 +89,13 @@ You can choose between five ways to use `Paint.[]` by setting `Paint.mode` to on
93
89
 
94
90
  Paint tries to automatically detect the proper value your terminal is capable of, please [open an issue](https://github.com/janlelis/paint/issues/new) if `Paint.detect_mode` yields a wrong value for you.
95
91
 
92
+ `Paint.detect_mode` will return 0 if the [NO_COLOR environment variable is set](https://github.com/jcs/no_color/).
93
+
96
94
  ## More Details About Terminal Colors and Effects
97
95
 
98
- Terminal colors/effects get created by [ANSI escape sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). These are strings that look like this: `\e[X;X;X;X;X]m` where X are integers with some meaning. For example, `0` means *reset*, `31` means *red foreground* and `41` stands for 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` into the sequence. The following colors are available:
96
+ <img src="https://pbs.twimg.com/media/ENyLvgVXUAgeDTn.jpg" />
97
+
98
+ Terminal colors/effects get created by [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). These are strings that look like this: `\e[X;X;X;X;X]m` where X are integers with some meaning. For example, `0` means *reset*, `31` means *red foreground* and `41` stands for 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` into the sequence. The following colors are available:
99
99
 
100
100
  * `:black`
101
101
  * `:red`
@@ -104,7 +104,7 @@ Terminal colors/effects get created by [ANSI escape sequences](http://en.wikiped
104
104
  * `:blue`
105
105
  * `:magenta`
106
106
  * `:cyan`
107
- * `:white`
107
+ * `:white`, `:gray`
108
108
  * (`:default`)
109
109
 
110
110
  When combined with the `:bright` (= `:bold`) effect, the color in the terminal emulator often differs a little bit, thus it is possible to represent 16 colors.
@@ -115,7 +115,7 @@ When using the `Paint.[]` method, Paint wraps the given string between the calcu
115
115
 
116
116
  ### Effects
117
117
 
118
- See [en.wikipedia.org/wiki/ANSI_escape_code](http://en.wikipedia.org/wiki/ANSI_escape_code) for a more detailed discussion:
118
+ See [en.wikipedia.org/wiki/ANSI_escape_code](https://en.wikipedia.org/wiki/ANSI_escape_code) for a more detailed discussion:
119
119
 
120
120
  #### Often supported
121
121
 
@@ -184,11 +184,11 @@ pa "Ruby", :red, :underline # same as puts Paint["Ruby", :red, :underline]
184
184
 
185
185
  ## Advanced Usage: Shortcuts
186
186
 
187
- There is an extension gem available which allows you to define custom color definitions, which you can reuse later. See [SHORTCUTS.md](https://github.com/janlelis/paint/blob/master/SHORTCUTS.md) for documentation. This is completely optional.
187
+ There is an extension gem available which allows you to define custom color definitions, which you can reuse later. See [SHORTCUTS.md](https://github.com/janlelis/paint/blob/main/SHORTCUTS.md) for documentation. This is completely optional.
188
188
 
189
189
  ## J-_-L
190
190
 
191
- Copyright (c) 2011-2016 Jan Lelis <http://janlelis.com>, released under the
191
+ Copyright (c) 2011-2020 Jan Lelis <https://janlelis.com>, released under the
192
192
  MIT license.
193
193
 
194
194
  Thank you to [rainbow](https://github.com/sickill/rainbow) and [term-ansicolor](https://github.com/flori/term-ansicolor) for ideas and inspiration. Also, a lot of thanks to all the [contributors](https://github.com/janlelis/paint/contributors)!
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ desc "Install the gem locally"
35
35
  task :install => :gems do
36
36
  gemspecs.each{ |gemspec|
37
37
  spec = gemspec_spec_for(gemspec)
38
- sh %{gem install pkg/#{spec.name}-#{spec.version}.gem --no-rdoc --no-ri}
38
+ sh %{gem install pkg/#{spec.name}-#{spec.version}.gem --no-doc}
39
39
  }
40
40
  end
41
41
 
@@ -172,7 +172,9 @@ module Paint
172
172
  # Determine supported colors
173
173
  # Note: there's no reliable test for 24-bit color support
174
174
  def detect_mode
175
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows
175
+ if ENV['NO_COLOR'] # see https://no-color.org/
176
+ 0
177
+ elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows
176
178
  if ENV['ANSICON']
177
179
  16
178
180
  elsif ENV['ConEmuANSI'] == 'ON'
@@ -180,14 +182,16 @@ module Paint
180
182
  else
181
183
  0
182
184
  end
185
+ elsif ENV['TERM_PROGRAM'] == 'Apple_Terminal'
186
+ 256
183
187
  else
184
188
  case ENV['TERM']
185
- when /-256color$/, 'xterm'
189
+ when /^rxvt-(?:.*)-256color$/
186
190
  256
187
- when /-color$/, 'rxvt'
191
+ when /-color$/, /^rxvt/
188
192
  16
189
193
  else # optimistic default
190
- 256
194
+ TRUE_COLOR
191
195
  end
192
196
  end
193
197
  end
@@ -226,7 +230,7 @@ module Paint
226
230
  end
227
231
 
228
232
  # Returns best ANSI color matching an RGB value, without fore-/background information
229
- # See http://mail.python.org/pipermail/python-list/2008-December/1150496.html
233
+ # See https://mail.python.org/pipermail/python-list/2008-December/1150496.html
230
234
  def rgb_to_ansi(red, green, blue, use_bright = false)
231
235
  color_pool = RGB_COLORS_ANSI.values
232
236
  color_pool += RGB_COLORS_ANSI_BRIGHT.values if use_bright
@@ -15,7 +15,7 @@ module Paint
15
15
  :blue => 4,
16
16
  :magenta => 5,
17
17
  :cyan => 6,
18
- :white => 7,
18
+ :white => 7, :gray => 7,
19
19
  :default => 9,
20
20
  }.freeze
21
21
 
@@ -27,7 +27,7 @@ module Paint
27
27
  :blue => 34,
28
28
  :magenta => 35,
29
29
  :cyan => 36,
30
- :white => 37,
30
+ :white => 37, :gray => 37,
31
31
  :default => 39,
32
32
  }.freeze
33
33
 
@@ -39,12 +39,12 @@ module Paint
39
39
  :blue => 44,
40
40
  :magenta => 45,
41
41
  :cyan => 46,
42
- :white => 47,
42
+ :white => 47, :gray => 47,
43
43
  :default => 49,
44
44
  }.freeze
45
45
 
46
46
  # Terminal effects - most of them are not supported ;)
47
- # See http://en.wikipedia.org/wiki/ANSI_escape_code
47
+ # See https://en.wikipedia.org/wiki/ANSI_escape_code
48
48
  ANSI_EFFECTS = {
49
49
  :reset => 0, :nothing => 0, # usually supported
50
50
  :bright => 1, :bold => 1, # usually supported
@@ -75,7 +75,7 @@ module Paint
75
75
  }.freeze
76
76
 
77
77
  # A list of color names for standard ansi colors, needed for 16/8 color fallback mode
78
- # See http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
78
+ # See https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
79
79
  RGB_COLORS_ANSI = {
80
80
  :black => [ 0, 0, 0],
81
81
  :red => [205, 0, 0],
@@ -84,11 +84,11 @@ module Paint
84
84
  :blue => [ 0, 0, 238],
85
85
  :magenta => [205, 0, 205],
86
86
  :cyan => [ 0, 205, 205],
87
- :white => [229, 229, 229],
87
+ :white => [229, 229, 229], :gray => [229, 229, 229],
88
88
  }.each { |k, v| v.freeze }.freeze
89
89
 
90
90
  # A list of color names for standard bright ansi colors, needed for 16 color fallback mode
91
- # See http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
91
+ # See https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
92
92
  RGB_COLORS_ANSI_BRIGHT = {
93
93
  :black => [127, 127, 127],
94
94
  :red => [255, 0, 0],
@@ -97,6 +97,6 @@ module Paint
97
97
  :blue => [ 92, 92, 255],
98
98
  :magenta => [255, 0, 255],
99
99
  :cyan => [ 0, 255, 255],
100
- :white => [255, 255, 255],
100
+ :white => [255, 255, 255], :gray => [255, 255, 255],
101
101
  }.each { |k, v| v.freeze }.freeze
102
102
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paint
2
- VERSION = "2.0.2".freeze
4
+ VERSION = "2.2.1"
3
5
  end
@@ -6,10 +6,10 @@ Gem::Specification.new do |s|
6
6
  s.name = "paint"
7
7
  s.version = Paint::VERSION
8
8
  s.authors = ["Jan Lelis"]
9
- s.email = "mail@janlelis.de"
9
+ s.email = ["hi@ruby.consulting"]
10
10
  s.homepage = "https://github.com/janlelis/paint"
11
11
  s.summary = "Terminal painter!"
12
- s.description = "Terminal painter: No string extensions / RGB and 256 color support / effect support. Usage: Paint['string', :red, :bright]"
12
+ s.description = "Terminal painter with RGB and 256 (fallback) color and terminal effects support. No string extensions! Usage: Paint['string', :red, :bright]"
13
13
  s.license = 'MIT'
14
14
 
15
15
  s.files = %w[
@@ -32,13 +32,12 @@ Gem::Specification.new do |s|
32
32
  ]
33
33
 
34
34
  s.required_ruby_version = '>= 1.9.3'
35
- s.requirements = ['Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)']
36
35
  s.add_development_dependency 'rspec', '~> 3.2'
37
- s.add_development_dependency 'rake', '~> 10.4'
36
+ s.add_development_dependency 'rake', '~> 12.3'
38
37
  s.add_development_dependency 'benchmark-ips', '~> 2.7'
39
- s.add_development_dependency 'rainbow', '~> 2.1'
40
- s.add_development_dependency 'term-ansicolor', '~> 1.4'
38
+ s.add_development_dependency 'rainbow', '~> 3.0'
39
+ s.add_development_dependency 'term-ansicolor', '~> 1.7'
41
40
  s.add_development_dependency 'ansi', '~> 1.5'
42
41
  s.add_development_dependency 'hansi', '~> 0.2'
43
- s.add_development_dependency 'pastel', '~> 0.6'
42
+ s.add_development_dependency 'pastel', '~> 0.7'
44
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: 2.0.2
4
+ version: 2.2.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: 2018-12-16 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.4'
33
+ version: '12.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.4'
40
+ version: '12.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: benchmark-ips
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.1'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.1'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: term-ansicolor
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.4'
75
+ version: '1.7'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.4'
82
+ version: '1.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ansi
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,17 +114,18 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.6'
117
+ version: '0.7'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.6'
125
- description: 'Terminal painter: No string extensions / RGB and 256 color support /
126
- effect support. Usage: Paint[''string'', :red, :bright]'
127
- email: mail@janlelis.de
124
+ version: '0.7'
125
+ description: 'Terminal painter with RGB and 256 (fallback) color and terminal effects
126
+ support. No string extensions! Usage: Paint[''string'', :red, :bright]'
127
+ email:
128
+ - hi@ruby.consulting
128
129
  executables: []
129
130
  extensions: []
130
131
  extra_rdoc_files:
@@ -164,10 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  - - ">="
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
- requirements:
168
- - 'Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)'
169
- rubyforge_project:
170
- rubygems_version: 2.7.7
168
+ requirements: []
169
+ rubygems_version: 3.1.2
171
170
  signing_key:
172
171
  specification_version: 4
173
172
  summary: Terminal painter!