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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40ce91bfc8f772f3a22829e81620a7ed6b5cbc0c17b2b779c2680811df98adfb
4
- data.tar.gz: c694153e0f54a6b310df3412379e2b57beaf393b72a70e659d6ce5b4489ab9e2
3
+ metadata.gz: 2d4c9c7de02c29ef865bd03c3e91309c2880726e8919e2a0c8916b9e935fe1c6
4
+ data.tar.gz: acfd302f192306092af688898d9186d7460c59646dce0df698cf32e29fb6212c
5
5
  SHA512:
6
- metadata.gz: f6276623790aed0ec56a46e3e86cd00e76d5579bb8d71044f3d58532af59c834c55ce15202ff2a64514a817810236b01f1fe22484a54ea9ee093e0f997312323
7
- data.tar.gz: 3207d0833c0a85159e77816b71d9c312c5d78f40c5f5fe00022d615ecbe19f24fd06bcbfbce9562085a925473544d2ced2e4ce472ee8d456f5d310f9ff6261db
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::Black.
97
- # - Luminance values >= 1 always translate to Color::RGB::White.
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::Black
105
+ Color::RGB::Black000
106
106
  elsif near_one_or_more?(l)
107
- Color::RGB::White
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 White so that the \RGB hue is the specified percentage of the
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::White, percent)
273
+ def lighten_by(percent) = mix_with(Color::RGB::WhiteFFF, percent)
271
274
 
272
275
  ##
273
- # Mix the \RGB hue with Black so that the \RGB hue is the specified percentage of the
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::Black, percent)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Color
4
- VERSION = "2.1.0" # :nodoc:
4
+ VERSION = "2.1.1" # :nodoc:
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: color
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler