ansi256 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +3 -0
  2. data/bin/ansi256 +8 -1
  3. data/lib/ansi256/version.rb +1 -1
  4. metadata +1 -1
data/README.md CHANGED
@@ -109,6 +109,9 @@ ansi256 yellow "Hello world"
109
109
  ansi256 /blue "Hello world"
110
110
  ansi256 yellow/blue "Hello world"
111
111
 
112
+ # RGB colors (only support 6-letter hex codes)
113
+ ansi256 ff9900/000033 "Hello world"
114
+
112
115
  # Mixed color codes
113
116
  ansi256 yellow/232 "Hello world"
114
117
 
data/bin/ansi256 CHANGED
@@ -13,7 +13,14 @@ end
13
13
  fgbg, *msg = ARGV
14
14
  fg, bg = fgbg.split('/').map { |e|
15
15
  if !e.to_s.empty?
16
- (e =~ /^\d+$/) ? e.to_i : e.downcase.to_sym
16
+ case e
17
+ when /^#?[0-9a-f]{6}$/i
18
+ e
19
+ when /^\d+$/
20
+ e.to_i
21
+ else
22
+ e.downcase.to_sym
23
+ end
17
24
  end
18
25
  }
19
26
 
@@ -1,3 +1,3 @@
1
1
  module Ansi256
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansi256
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: