ex_aequo 0.1.2 → 0.1.3

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: 8b6cd6a07b2a9d435aeadf493afb7c3efb927697e24ba774e524d2c05d0345dc
4
- data.tar.gz: 6d7ad31a36ccd40db1673cf2bb9e50303cb23300a1f0455fcdae85cb217c21ed
3
+ metadata.gz: 394e714f95ecbb3b54b5a264ce5be367d235fcebe7513b89d48d0491de236312
4
+ data.tar.gz: 177328fccfa5fbfd1911944ac5d6a65ccf7a7315589930d91beb764e413b2c4f
5
5
  SHA512:
6
- metadata.gz: 1d58560196e7c7a9ba5ab95eacced6545843a35e12c0b5cea22e43cdeb3e2d416012e4328f625d482dfdcce77b18d83320b22ac0224764555220e8fc750bd026
7
- data.tar.gz: 1f4ca9354ac79edd8cb66690bb2b89986bd2a1411393862be7baefbfcd8dbfc62d349dad1f7f4cf4d7146636bc54049295ab0cbacd044bd52ca81c3160619b91
6
+ metadata.gz: c929dc3f52e077403241a32d114e36f76629f62c0da14d4927b03b6845bdfba0e3a1240d5a0b4285b048e2971a5898af675b86a80c5830fb35fc404a52d343ce
7
+ data.tar.gz: 2c2966155b1b3ddb5ca671105568248b8e1e1f6e1ebc205d4d91dc3582343969ecf1ca9bd56f2f7906f322011ab376047b699afea2c9925f1bedd399a32f7061
@@ -9,6 +9,7 @@ module ExAequo
9
9
  ansi: nil,
10
10
  ansi256: nil,
11
11
  rgb: nil,
12
+ web: nil
12
13
  }.freeze
13
14
 
14
15
  StyleKeywords = {
@@ -42,7 +43,7 @@ module ExAequo
42
43
 
43
44
  def _check_rgb_args!(kwds)
44
45
  unless kwds.values_at(*ColorMethodKeywords.keys).compact.size == 1
45
- raise ArgumentError, 'need to specify exactly one of the following keyword arguments: :ansi, :ansi256, :rgb'
46
+ raise ArgumentError, 'need to specify exactly one of the following keyword arguments: :ansi, :ansi256, :rgb, :web'
46
47
  end
47
48
 
48
49
  if kwds[:rgb] && Access.any_key?(kwds, :bold, :dim)
@@ -54,9 +55,11 @@ module ExAequo
54
55
  end
55
56
 
56
57
  def _color_code(**kwds)
57
- kwds => {ansi:, ansi256:, rgb:, italic:, underline:}
58
+ kwds => {ansi:, ansi256:, rgb:, web:, italic:, underline:}
58
59
  if rgb
59
60
  ExAequo::Color.rgb(*Array(rgb), italic:, underline:)
61
+ elsif web
62
+ ExAequo::Color.rgb(*ExAequo::Color::Web.to_rgb(web), italic:, underline:)
60
63
  elsif ansi
61
64
  ExAequo::Color.ansi(ansi, **kwds.slice(*StyleKeywords.keys))
62
65
  else
@@ -0,0 +1,165 @@
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
@@ -6,6 +6,7 @@ require_relative 'kernel/fn'
6
6
  require_relative 'color/ansi'
7
7
  require_relative 'color/ansi256'
8
8
  require_relative 'color/rgb'
9
+ require_relative 'color/web'
9
10
 
10
11
  require_relative 'color/colorizer'
11
12
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ExAequo
4
4
  module Version
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
8
8
  # SPDX-License-Identifier: Apache-2.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ex_aequo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
@@ -27,6 +27,7 @@ files:
27
27
  - lib/ex_aequo/color/colorizer.rb
28
28
  - lib/ex_aequo/color/modifiers.rb
29
29
  - lib/ex_aequo/color/rgb.rb
30
+ - lib/ex_aequo/color/web.rb
30
31
  - lib/ex_aequo/kernel.rb
31
32
  - lib/ex_aequo/kernel/access.rb
32
33
  - lib/ex_aequo/kernel/fn.rb