color 2.1.0 → 2.1.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/color/hsl.rb +4 -4
- data/lib/color/rgb.rb +7 -4
- data/lib/color/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4c9c7de02c29ef865bd03c3e91309c2880726e8919e2a0c8916b9e935fe1c6
|
4
|
+
data.tar.gz: acfd302f192306092af688898d9186d7460c59646dce0df698cf32e29fb6212c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7bf088dca85deeb798f0c68542fc1f1fac08e7f629e41b38c91d95537d963ce603768a290af699c5e3b71bcb3183f165c438bf8769d12fd6c84a6e0167b127b
|
7
|
+
data.tar.gz: 185273ad56535d55992ab8f78aec618f9b65ce6407ee68c2c5c56475660c87d536941bea440852393030369906bc55ed5daaf1da97340f8879c743b79b583edf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.1.1 / 2025-08-08
|
4
|
+
|
5
|
+
Color 2.1.1 fixes a bug where `Color::RGB::Black` and `Color::RGB::White` are no
|
6
|
+
longer defined automatically because they are part of `color/rgb/colors`.
|
7
|
+
Internally, this defines `Color::RGB::Black000` and `Color::RGB::WhiteFFF`.
|
8
|
+
|
3
9
|
## 2.1.0 / 2025-07-20
|
4
10
|
|
5
11
|
Color 2.1.0 fixes a computation bug where CIE XYZ values were improperly clamped
|
data/lib/color/hsl.rb
CHANGED
@@ -93,8 +93,8 @@ class Color::HSL
|
|
93
93
|
# fvd and van Dam, originally found at [1] (implemented similarly at [2]). This
|
94
94
|
# simplifies the calculations with the following assumptions:
|
95
95
|
#
|
96
|
-
# - Luminance values <= 0 always translate to Color::RGB
|
97
|
-
# - Luminance values >= 1 always translate to Color::RGB
|
96
|
+
# - Luminance values <= 0 always translate to a black Color::RGB value.
|
97
|
+
# - Luminance values >= 1 always translate to a white Color::RGB value.
|
98
98
|
# - Saturation values <= 0 always translate to a shade of gray using luminance as
|
99
99
|
# a percentage of gray.
|
100
100
|
#
|
@@ -102,9 +102,9 @@ class Color::HSL
|
|
102
102
|
# [2] http://support.microsoft.com/kb/29240
|
103
103
|
def to_rgb(...)
|
104
104
|
if near_zero_or_less?(l)
|
105
|
-
Color::RGB::
|
105
|
+
Color::RGB::Black000
|
106
106
|
elsif near_one_or_more?(l)
|
107
|
-
Color::RGB::
|
107
|
+
Color::RGB::WhiteFFF
|
108
108
|
elsif near_zero?(s)
|
109
109
|
Color::RGB.from_fraction(l, l, l)
|
110
110
|
else
|
data/lib/color/rgb.rb
CHANGED
@@ -63,6 +63,9 @@ class Color::RGB
|
|
63
63
|
super(r: normalize(r), g: normalize(g), b: normalize(b), names: names)
|
64
64
|
end
|
65
65
|
|
66
|
+
Black000 = new(r: 0x00, g: 0x00, b: 0x00) # :nodoc:
|
67
|
+
WhiteFFF = new(r: 0xff, g: 0xff, b: 0xff) # :nodoc:
|
68
|
+
|
66
69
|
##
|
67
70
|
# :attr_reader: name
|
68
71
|
# The primary name for this \RGB color.
|
@@ -263,18 +266,18 @@ class Color::RGB
|
|
263
266
|
def delta_e2000(other) = to_lab.delta_e2000(coerce(other).to_lab)
|
264
267
|
|
265
268
|
##
|
266
|
-
# Mix the \RGB hue with
|
269
|
+
# Mix the \RGB hue with white so that the \RGB hue is the specified percentage of the
|
267
270
|
# resulting color.
|
268
271
|
#
|
269
272
|
# Strictly speaking, this isn't a `lighten_by` operation, but it mostly works.
|
270
|
-
def lighten_by(percent) = mix_with(Color::RGB::
|
273
|
+
def lighten_by(percent) = mix_with(Color::RGB::WhiteFFF, percent)
|
271
274
|
|
272
275
|
##
|
273
|
-
# Mix the \RGB hue with
|
276
|
+
# Mix the \RGB hue with black so that the \RGB hue is the specified percentage of the
|
274
277
|
# resulting color.
|
275
278
|
#
|
276
279
|
# Strictly speaking, this isn't a `darken_by` operation, but it mostly works.
|
277
|
-
def darken_by(percent) = mix_with(Color::RGB::
|
280
|
+
def darken_by(percent) = mix_with(Color::RGB::Black000, percent)
|
278
281
|
|
279
282
|
##
|
280
283
|
# Mix the mask color with the current color at the stated opacity percentage (0..100).
|
data/lib/color/version.rb
CHANGED