ex_aequo 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -50
- data/lib/ex_aequo/colorize/color_definitions.rb +513 -0
- data/lib/ex_aequo/colorize.rb +13 -0
- data/lib/ex_aequo/colorizer.rb +130 -0
- data/lib/ex_aequo/kernel/enumerable.rb +18 -0
- data/lib/ex_aequo/kernel/fn.rb +3 -0
- data/lib/ex_aequo/kernel/match_data.rb +6 -0
- data/lib/ex_aequo/my_struct/class_methods.rb +1 -0
- data/lib/ex_aequo/version.rb +1 -1
- data/lib/ex_aequo.rb +1 -1
- metadata +23 -13
- data/lib/ex_aequo/color/ansi.rb +0 -38
- data/lib/ex_aequo/color/ansi256.rb +0 -21
- data/lib/ex_aequo/color/colorizer.rb +0 -76
- data/lib/ex_aequo/color/modifiers.rb +0 -27
- data/lib/ex_aequo/color/rgb.rb +0 -63
- data/lib/ex_aequo/color/text.rb +0 -51
- data/lib/ex_aequo/color/web.rb +0 -165
- data/lib/ex_aequo/color.rb +0 -44
- data/lib/ex_aequo/colors.rb +0 -29
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
def find_value(&block)
|
5
|
+
each do |ele|
|
6
|
+
case block.(ele)
|
7
|
+
in nil
|
8
|
+
nil
|
9
|
+
in false
|
10
|
+
false
|
11
|
+
in value
|
12
|
+
return value
|
13
|
+
end
|
14
|
+
end
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
data/lib/ex_aequo/kernel/fn.rb
CHANGED
data/lib/ex_aequo/version.rb
CHANGED
data/lib/ex_aequo.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ex_aequo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Dober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forwarder3
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ostruct
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: 'Some tools
|
28
42
|
|
29
43
|
'
|
@@ -37,18 +51,14 @@ files:
|
|
37
51
|
- lib/ex_aequo.rb
|
38
52
|
- lib/ex_aequo/args.rb
|
39
53
|
- lib/ex_aequo/args_parser.rb
|
40
|
-
- lib/ex_aequo/
|
41
|
-
- lib/ex_aequo/
|
42
|
-
- lib/ex_aequo/
|
43
|
-
- lib/ex_aequo/color/colorizer.rb
|
44
|
-
- lib/ex_aequo/color/modifiers.rb
|
45
|
-
- lib/ex_aequo/color/rgb.rb
|
46
|
-
- lib/ex_aequo/color/text.rb
|
47
|
-
- lib/ex_aequo/color/web.rb
|
48
|
-
- lib/ex_aequo/colors.rb
|
54
|
+
- lib/ex_aequo/colorize.rb
|
55
|
+
- lib/ex_aequo/colorize/color_definitions.rb
|
56
|
+
- lib/ex_aequo/colorizer.rb
|
49
57
|
- lib/ex_aequo/kernel.rb
|
50
58
|
- lib/ex_aequo/kernel/access.rb
|
59
|
+
- lib/ex_aequo/kernel/enumerable.rb
|
51
60
|
- lib/ex_aequo/kernel/fn.rb
|
61
|
+
- lib/ex_aequo/kernel/match_data.rb
|
52
62
|
- lib/ex_aequo/my_struct.rb
|
53
63
|
- lib/ex_aequo/my_struct/class_methods.rb
|
54
64
|
- lib/ex_aequo/tools/text_scanner.rb
|
@@ -65,14 +75,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
75
|
requirements:
|
66
76
|
- - ">="
|
67
77
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
78
|
+
version: 3.3.0
|
69
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
80
|
requirements:
|
71
81
|
- - ">="
|
72
82
|
- !ruby/object:Gem::Version
|
73
83
|
version: '0'
|
74
84
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.5.16
|
76
86
|
signing_key:
|
77
87
|
specification_version: 4
|
78
88
|
summary: Some tools
|
data/lib/ex_aequo/color/ansi.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'modifiers'
|
4
|
-
module ExAequo
|
5
|
-
module Color
|
6
|
-
module Ansi
|
7
|
-
extend self
|
8
|
-
include ExAequo::Color::Modifiers
|
9
|
-
|
10
|
-
AnsiColorEscape = {
|
11
|
-
black: 30,
|
12
|
-
red: 31,
|
13
|
-
green: 32,
|
14
|
-
yellow: 33,
|
15
|
-
blue: 34,
|
16
|
-
magenta: 35,
|
17
|
-
cyan: 36,
|
18
|
-
white: 37
|
19
|
-
}.freeze
|
20
|
-
|
21
|
-
def ansi(name, bold: false, dim: false, italic: false, underline: false)
|
22
|
-
case AnsiColorEscape.fetch(name.to_s.downcase.to_sym, nil)
|
23
|
-
in nil
|
24
|
-
raise IllegalColor, "#{name} is not one of the 8 legal basic ansi color names: #{_legal_ansi_color_names}"
|
25
|
-
in value
|
26
|
-
"\e[#{value}#{postfix_modifiers(bold:, dim:, italic:, underline:)}m"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def _legal_ansi_color_names
|
33
|
-
AnsiColorEscape.keys.inspect
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
# SPDX-License-Identifier: Apache-2.0
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'modifiers'
|
4
|
-
module ExAequo
|
5
|
-
module Color
|
6
|
-
module Ansi256
|
7
|
-
extend self
|
8
|
-
include ExAequo::Color::Modifiers
|
9
|
-
|
10
|
-
def ansi256(color, bold: false, dim: false, italic: false, underline: false)
|
11
|
-
case color
|
12
|
-
in 0..255
|
13
|
-
"\e[38;5;#{color}#{postfix_modifiers(bold:, dim:, italic:, underline:)}m"
|
14
|
-
else
|
15
|
-
raise IllegalColor, "#{color.inspect} is not a color number between 0 and 255"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
# SPDX-License-Identifier: Apache-2.0
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ExAequo
|
4
|
-
module Color
|
5
|
-
module Colorizer
|
6
|
-
extend self
|
7
|
-
|
8
|
-
ColorMethodKeywords = {
|
9
|
-
ansi: nil,
|
10
|
-
ansi256: nil,
|
11
|
-
rgb: nil,
|
12
|
-
web: nil
|
13
|
-
}.freeze
|
14
|
-
|
15
|
-
StyleKeywords = {
|
16
|
-
bold: nil,
|
17
|
-
dim: nil,
|
18
|
-
italic: nil,
|
19
|
-
underline: nil
|
20
|
-
}.freeze
|
21
|
-
|
22
|
-
ColorizeKeywords = ColorMethodKeywords.merge(StyleKeywords).merge(reset: true)
|
23
|
-
|
24
|
-
def colorize(text, **kwds)
|
25
|
-
kwds = ColorizeKeywords.merge(kwds)
|
26
|
-
_check_args!(kwds)
|
27
|
-
|
28
|
-
[
|
29
|
-
_color_code(**kwds),
|
30
|
-
text,
|
31
|
-
_maybe_reset(kwds[:reset])
|
32
|
-
].join
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def _check_args!(kwds)
|
38
|
-
spurious = kwds.keys - ColorizeKeywords.keys
|
39
|
-
raise ArgumentError, "illegal keywords #{spurious}, allowed: #{ColorizeKeywords.keys}" unless spurious.empty?
|
40
|
-
|
41
|
-
_check_rgb_args!(kwds)
|
42
|
-
end
|
43
|
-
|
44
|
-
def _check_rgb_args!(kwds)
|
45
|
-
unless kwds.values_at(*ColorMethodKeywords.keys).compact.size == 1
|
46
|
-
raise ArgumentError, 'need to specify exactly one of the following keyword arguments: :ansi, :ansi256, :rgb, :web'
|
47
|
-
end
|
48
|
-
|
49
|
-
if kwds[:rgb] && Access.any_key?(kwds, :bold, :dim)
|
50
|
-
raise(
|
51
|
-
ArgumentError,
|
52
|
-
'specifying bold and/or dim with rgb does not make sense'
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def _color_code(**kwds)
|
58
|
-
kwds => {ansi:, ansi256:, rgb:, web:, italic:, underline:}
|
59
|
-
if rgb
|
60
|
-
ExAequo::Color.rgb(*Array(rgb), italic:, underline:)
|
61
|
-
elsif web
|
62
|
-
ExAequo::Color.rgb(*ExAequo::Color::Web.to_rgb(web), italic:, underline:)
|
63
|
-
elsif ansi
|
64
|
-
ExAequo::Color.ansi(ansi, **kwds.slice(*StyleKeywords.keys))
|
65
|
-
else
|
66
|
-
ExAequo::Color.ansi256(ansi256, **kwds.slice(*StyleKeywords.keys))
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def _maybe_reset(reset)
|
71
|
-
reset ? ExAequo::Color.reset : nil
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
# SPDX-License-Identifier: Apache-2.0
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ExAequo
|
4
|
-
module Color
|
5
|
-
module Modifiers extend self
|
6
|
-
ModifierValues = {
|
7
|
-
bold: 1,
|
8
|
-
dim: 2,
|
9
|
-
italic: 3,
|
10
|
-
underline: 4
|
11
|
-
}.freeze
|
12
|
-
|
13
|
-
def postfix_modifiers(bold: nil, dim: nil, italic: nil, underline: nil)
|
14
|
-
[
|
15
|
-
bold ? :bold : nil,
|
16
|
-
dim ? :dim : nil,
|
17
|
-
italic ? :italic : nil,
|
18
|
-
underline ? :underline : nil
|
19
|
-
].compact
|
20
|
-
.map(&Access.hash_by_key(ModifierValues))
|
21
|
-
.map(&Fn.prefix_string(';'))
|
22
|
-
.join
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
# SPDX-License-Identifier: Apache-2.0
|
data/lib/ex_aequo/color/rgb.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'modifiers'
|
4
|
-
module ExAequo
|
5
|
-
module Color
|
6
|
-
module Rgb
|
7
|
-
extend self
|
8
|
-
|
9
|
-
def rgb(red, green = nil, blue = nil, **kwds)
|
10
|
-
if green && blue
|
11
|
-
_rgb(red, green, blue, **kwds)
|
12
|
-
else
|
13
|
-
raise ArgumentError, 'takes 1 or 3 parameters, given two' if green
|
14
|
-
|
15
|
-
_rgb(*_hex_to_triple(red), **kwds)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def _check_rgb(red, green, blue)
|
22
|
-
if _check_rgb_byte(red) && _check_rgb_byte(green) && _check_rgb_byte(blue)
|
23
|
-
:ok
|
24
|
-
else
|
25
|
-
"#{[red, green, blue]} is not a legal rgb specification, need three bytes (0..255)"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def _check_rgb_byte(byte)
|
30
|
-
case byte
|
31
|
-
in 0..255
|
32
|
-
true
|
33
|
-
else
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
LeadingHashRgx = %r{\A#}
|
39
|
-
def _hex_to_triple(hex)
|
40
|
-
chex = hex.sub(LeadingHashRgx, '')
|
41
|
-
case chex.grapheme_clusters.each_slice(2).map(&:join).map { Integer(_1, 16) }
|
42
|
-
in r, g, b
|
43
|
-
[r, g, b]
|
44
|
-
else
|
45
|
-
raise IllegalColor, "#{hex} is not a legal rgb hex string"
|
46
|
-
end
|
47
|
-
rescue ArgumentError
|
48
|
-
raise IllegalColor, "#{hex} is not a legal rgb hex string"
|
49
|
-
end
|
50
|
-
|
51
|
-
def _rgb(red, green, blue, italic: false, underline: false)
|
52
|
-
case _check_rgb(red, green, blue)
|
53
|
-
in :ok
|
54
|
-
modifier = ExAequo::Color::Modifiers.postfix_modifiers(italic:, underline:)
|
55
|
-
"\e[38;2;#{red};#{green};#{blue}#{modifier}m"
|
56
|
-
in message
|
57
|
-
raise IllegalColor, message
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
# SPDX-License-Identifier: Apache-2.0
|
data/lib/ex_aequo/color/text.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../color'
|
4
|
-
module ExAequo
|
5
|
-
module Color
|
6
|
-
|
7
|
-
module Text extend self
|
8
|
-
Specials = {
|
9
|
-
bold: ExAequo::Color::Ansi.ansi(:white, bold: true),
|
10
|
-
eol: "\n",
|
11
|
-
reset: ExAequo::Color.reset
|
12
|
-
}
|
13
|
-
|
14
|
-
def put_col(*segments, to: $stdout)
|
15
|
-
to.puts(colorized_text(segments))
|
16
|
-
end
|
17
|
-
|
18
|
-
def colorized_text(*segments)
|
19
|
-
if ENV['NO_COLOR']
|
20
|
-
segments.flatten.filter { String === _1 }.join
|
21
|
-
else
|
22
|
-
segments.flatten.map(&_color_or_text).join
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
|
29
|
-
def _color_or_text
|
30
|
-
-> color_or_text do
|
31
|
-
case color_or_text
|
32
|
-
when Symbol
|
33
|
-
_colorize(color_or_text)
|
34
|
-
else
|
35
|
-
color_or_text
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def _colorize(color)
|
41
|
-
case ExAequo::Color::Ansi::AnsiColorEscape[color]
|
42
|
-
when nil
|
43
|
-
Specials.fetch(color) { raise ArgumentError, "#{color} not yet implemented" }
|
44
|
-
else
|
45
|
-
ExAequo::Color::Ansi.ansi(color)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
# SPDX-License-Identifier: Apache-2.0
|
data/lib/ex_aequo/color/web.rb
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ExAequo
|
4
|
-
module Color
|
5
|
-
module Web
|
6
|
-
extend self
|
7
|
-
|
8
|
-
WebColorNames = {
|
9
|
-
'aliceblue' => [240, 248, 255],
|
10
|
-
'antiquewhite' => [250, 235, 215],
|
11
|
-
'aqua' => [0, 255, 255],
|
12
|
-
'aquamarine' => [127, 255, 212],
|
13
|
-
'azure' => [240, 255, 255],
|
14
|
-
'beige' => [245, 245, 220],
|
15
|
-
'bisque' => [255, 228, 196],
|
16
|
-
'black' => [0, 0, 0],
|
17
|
-
'blanchedalmond' => [255, 235, 205],
|
18
|
-
'blue' => [0, 0, 255],
|
19
|
-
'blueviolet' => [138, 43, 226],
|
20
|
-
'brown' => [165, 42, 42],
|
21
|
-
'burlywood' => [222, 184, 135],
|
22
|
-
'cadetblue' => [95, 158, 160],
|
23
|
-
'chartreuse' => [127, 255, 0],
|
24
|
-
'chocolate' => [210, 105, 30],
|
25
|
-
'coral' => [255, 127, 80],
|
26
|
-
'cornflowerblue' => [100, 149, 237],
|
27
|
-
'cornsilk' => [255, 248, 220],
|
28
|
-
'crimson' => [220, 20, 60],
|
29
|
-
'cyan' => [0, 255, 255],
|
30
|
-
'darkblue' => [0, 0, 139],
|
31
|
-
'darkcyan' => [0, 139, 139],
|
32
|
-
'darkgoldenrod' => [184, 134, 11],
|
33
|
-
'darkgray' => [169, 169, 169],
|
34
|
-
'darkgreen' => [0, 100, 0],
|
35
|
-
'darkgrey' => [169, 169, 169],
|
36
|
-
'darkkhaki' => [189, 183, 107],
|
37
|
-
'darkmagenta' => [139, 0, 139],
|
38
|
-
'darkolivegreen' => [85, 107, 47],
|
39
|
-
'darkorange' => [255, 140, 0],
|
40
|
-
'darkorchid' => [153, 50, 204],
|
41
|
-
'darkred' => [139, 0, 0],
|
42
|
-
'darksalmon' => [233, 150, 122],
|
43
|
-
'darkseagreen' => [143, 188, 143],
|
44
|
-
'darkslateblue' => [72, 61, 139],
|
45
|
-
'darkslategray' => [47, 79, 79],
|
46
|
-
'darkslategrey' => [47, 79, 79],
|
47
|
-
'darkturquoise' => [0, 206, 209],
|
48
|
-
'darkviolet' => [148, 0, 211],
|
49
|
-
'deeppink' => [255, 20, 147],
|
50
|
-
'deepskyblue' => [0, 191, 255],
|
51
|
-
'dimgray' => [105, 105, 105],
|
52
|
-
'dimgrey' => [105, 105, 105],
|
53
|
-
'dodgerblue' => [30, 144, 255],
|
54
|
-
'firebrick' => [178, 34, 34],
|
55
|
-
'floralwhite' => [255, 250, 240],
|
56
|
-
'forestgreen' => [34, 139, 34],
|
57
|
-
'fuchsia' => [255, 0, 255],
|
58
|
-
'gainsboro' => [220, 220, 220],
|
59
|
-
'ghostwhite' => [248, 248, 255],
|
60
|
-
'gold' => [255, 215, 0],
|
61
|
-
'goldenrod' => [218, 165, 32],
|
62
|
-
'gray' => [128, 128, 128],
|
63
|
-
'green' => [0, 128, 0],
|
64
|
-
'greenyellow' => [173, 255, 47],
|
65
|
-
'grey' => [128, 128, 128],
|
66
|
-
'honeydew' => [240, 255, 240],
|
67
|
-
'hotpink' => [255, 105, 180],
|
68
|
-
'indianred' => [205, 92, 92],
|
69
|
-
'indigo' => [75, 0, 130],
|
70
|
-
'ivory' => [255, 255, 240],
|
71
|
-
'khaki' => [240, 230, 140],
|
72
|
-
'lavender' => [230, 230, 250],
|
73
|
-
'lavenderblush' => [255, 240, 245],
|
74
|
-
'lawngreen' => [124, 252, 0],
|
75
|
-
'lemonchiffon' => [255, 250, 205],
|
76
|
-
'lightblue' => [173, 216, 230],
|
77
|
-
'lightcoral' => [240, 128, 128],
|
78
|
-
'lightcyan' => [224, 255, 255],
|
79
|
-
'lightgoldenrodyellow' => [250, 250, 210],
|
80
|
-
'lightgray' => [211, 211, 211],
|
81
|
-
'lightgreen' => [144, 238, 144],
|
82
|
-
'lightgrey' => [211, 211, 211],
|
83
|
-
'lightpink' => [255, 182, 193],
|
84
|
-
'lightsalmon' => [255, 160, 122],
|
85
|
-
'lightseagreen' => [32, 178, 170],
|
86
|
-
'lightskyblue' => [135, 206, 250],
|
87
|
-
'lightslategray' => [119, 136, 153],
|
88
|
-
'lightslategrey' => [119, 136, 153],
|
89
|
-
'lightsteelblue' => [176, 196, 222],
|
90
|
-
'lightyellow' => [255, 255, 224],
|
91
|
-
'lime' => [0, 255, 0],
|
92
|
-
'limegreen' => [50, 205, 50],
|
93
|
-
'linen' => [250, 240, 230],
|
94
|
-
'magenta' => [255, 0, 255],
|
95
|
-
'maroon' => [128, 0, 0],
|
96
|
-
'mediumaquamarine' => [102, 205, 170],
|
97
|
-
'mediumblue' => [0, 0, 205],
|
98
|
-
'mediumorchid' => [186, 85, 211],
|
99
|
-
'mediumpurple' => [147, 112, 219],
|
100
|
-
'mediumseagreen' => [60, 179, 113],
|
101
|
-
'mediumslateblue' => [123, 104, 238],
|
102
|
-
'mediumspringgreen' => [0, 250, 154],
|
103
|
-
'mediumturquoise' => [72, 209, 204],
|
104
|
-
'mediumvioletred' => [199, 21, 133],
|
105
|
-
'midnightblue' => [25, 25, 112],
|
106
|
-
'mintcream' => [245, 255, 250],
|
107
|
-
'mistyrose' => [255, 228, 225],
|
108
|
-
'moccasin' => [255, 228, 181],
|
109
|
-
'navajowhite' => [255, 222, 173],
|
110
|
-
'navy' => [0, 0, 128],
|
111
|
-
'oldlace' => [253, 245, 230],
|
112
|
-
'olive' => [128, 128, 0],
|
113
|
-
'olivedrab' => [107, 142, 35],
|
114
|
-
'orange' => [255, 165, 0],
|
115
|
-
'orangered' => [255, 69, 0],
|
116
|
-
'orchid' => [218, 112, 214],
|
117
|
-
'palegoldenrod' => [238, 232, 170],
|
118
|
-
'palegreen' => [152, 251, 152],
|
119
|
-
'paleturquoise' => [175, 238, 238],
|
120
|
-
'palevioletred' => [219, 112, 147],
|
121
|
-
'papayawhip' => [255, 239, 213],
|
122
|
-
'peachpuff' => [255, 218, 185],
|
123
|
-
'peru' => [205, 133, 63],
|
124
|
-
'pink' => [255, 192, 203],
|
125
|
-
'plum' => [221, 160, 221],
|
126
|
-
'powderblue' => [176, 224, 230],
|
127
|
-
'purple' => [128, 0, 128],
|
128
|
-
'red' => [255, 0, 0],
|
129
|
-
'rosybrown' => [188, 143, 143],
|
130
|
-
'royalblue' => [65, 105, 225],
|
131
|
-
'saddlebrown' => [139, 69, 19],
|
132
|
-
'salmon' => [250, 128, 114],
|
133
|
-
'sandybrown' => [244, 164, 96],
|
134
|
-
'seagreen' => [46, 139, 87],
|
135
|
-
'seashell' => [255, 245, 238],
|
136
|
-
'sienna' => [160, 82, 45],
|
137
|
-
'silver' => [192, 192, 192],
|
138
|
-
'skyblue' => [135, 206, 235],
|
139
|
-
'slateblue' => [106, 90, 205],
|
140
|
-
'slategray' => [112, 128, 144],
|
141
|
-
'slategrey' => [112, 128, 144],
|
142
|
-
'snow' => [255, 250, 250],
|
143
|
-
'springgreen' => [0, 255, 127],
|
144
|
-
'steelblue' => [70, 130, 180],
|
145
|
-
'tan' => [210, 180, 140],
|
146
|
-
'teal' => [0, 128, 128],
|
147
|
-
'thistle' => [216, 191, 216],
|
148
|
-
'tomato' => [255, 99, 71],
|
149
|
-
'transparent' => [0, 0, 0],
|
150
|
-
'turquoise' => [64, 224, 208],
|
151
|
-
'violet' => [238, 130, 238],
|
152
|
-
'wheat' => [245, 222, 179],
|
153
|
-
'white' => [255, 255, 255],
|
154
|
-
'whitesmoke' => [245, 245, 245],
|
155
|
-
'yellow' => [255, 255, 0],
|
156
|
-
'yellowgreen' => [154, 205, 50],
|
157
|
-
'rebeccapurple' => [102, 51, 153]
|
158
|
-
}.freeze
|
159
|
-
def to_rgb(color)
|
160
|
-
WebColorNames.fetch(color.to_s.downcase) { raise ArgumentError, "unsupported web color: #{color}" }
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
# SPDX-License-Identifier: Apache-2.0
|
data/lib/ex_aequo/color.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'kernel/access'
|
4
|
-
require_relative 'kernel/fn'
|
5
|
-
|
6
|
-
require_relative 'color/ansi'
|
7
|
-
require_relative 'color/ansi256'
|
8
|
-
require_relative 'color/rgb'
|
9
|
-
require_relative 'color/web'
|
10
|
-
|
11
|
-
require_relative 'color/colorizer'
|
12
|
-
|
13
|
-
module ExAequo
|
14
|
-
module Color
|
15
|
-
extend self
|
16
|
-
|
17
|
-
class IllegalColor < RuntimeError; end
|
18
|
-
|
19
|
-
def ansi(color, **kwds)
|
20
|
-
ExAequo::Color::Ansi.ansi(color, **kwds)
|
21
|
-
end
|
22
|
-
|
23
|
-
def ansi256(color, **kwds)
|
24
|
-
ExAequo::Color::Ansi256.ansi256(color, **kwds)
|
25
|
-
end
|
26
|
-
|
27
|
-
def colorize(text, **params)
|
28
|
-
if ENV['NO_COLOR']
|
29
|
-
text
|
30
|
-
else
|
31
|
-
ExAequo::Color::Colorizer.colorize(text, **params)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def reset
|
36
|
-
"\e[0m"
|
37
|
-
end
|
38
|
-
|
39
|
-
def rgb(*args, **kwds)
|
40
|
-
ExAequo::Color::Rgb.rgb(*args, **kwds)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
# SPDX-License-Identifier: Apache-2.0
|
data/lib/ex_aequo/colors.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'color/colorizer'
|
4
|
-
module ExAequo
|
5
|
-
module Colors
|
6
|
-
extend self
|
7
|
-
|
8
|
-
def ansi(text, ansi, **kwds)
|
9
|
-
ExAequo::Color::Colorizer.colorize(text, ansi:, **kwds)
|
10
|
-
end
|
11
|
-
|
12
|
-
def ansi256(text, ansi256, **kwds)
|
13
|
-
ExAequo::Color::Colorizer.colorize(text, ansi256:, **kwds)
|
14
|
-
end
|
15
|
-
|
16
|
-
def rgb(text, *args, **kwds)
|
17
|
-
if args.size == 1
|
18
|
-
ExAequo::Color::Colorizer.colorize(text, rgb: args.first, **kwds)
|
19
|
-
else
|
20
|
-
ExAequo::Color::Colorizer.colorize(text, rgb: args, **kwds)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def method_missing(name, text, **kwds)
|
25
|
-
ExAequo::Color::Colorizer.colorize(text, web: name, **kwds)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
# SPDX-License-Identifier: Apache-2.0
|