color 2.0.0.pre.0 → 2.0.0.pre.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: 4e5858bb16512729edfebe8016f4f773cba22557703a83532c0bdf741d1bae34
4
- data.tar.gz: ad8833b876bbf9e3b8741044a7d2714c324f4938764745584fe23b3cb0b70be8
3
+ metadata.gz: 1d67585f5f81335c4e8f679912c4600f5cd183bcfe6072bc40c458a8d825fde4
4
+ data.tar.gz: 0b6a1c7c6b090805d8df447e3e5e86940d1e07b12e3400d90d1ae0c523f37ab6
5
5
  SHA512:
6
- metadata.gz: 96ad5fe214c3d719626d2ba4a205053f2feccd1d93a405f9f1c9fc3b17afe84a43fb0f1cf2eed24440f1788348bd560f44dbb0510d8994e5c596fd5290a11346
7
- data.tar.gz: ce74123cb7c51a3e875bdc8f210df2c6e7b1f5bb64e63f1b9d6de9debd6a2ddab5c3b9d8ceeda19eaee6a90be3b5dbc571df9c6fd1b3d7b8b0d15addf20fc25c
6
+ metadata.gz: aea11ce9923c90da5ac785fa0d314eb3dce2c4aacd919e5a522d5f0ee1d6b6ef2158890985d8a0c32b7db596a9043529a1f3c94ba70d9489f07c28f18e8a50a2
7
+ data.tar.gz: 5613ee60327f1ec52a56275fdf8af4d0a39b46dcfbecdb69a5e1f7b6037cc8e029228445410cb310ee85784e5574b58d9715f4c0bf76c87fc31c7b90eaf21bae
data/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0.pre.0 / 2025-06-15
3
+ ## 2.0.0.pre.1 / 2025-06-16
4
4
 
5
5
  Color 2.0.0 is a major release of the Color library.
6
6
 
@@ -56,7 +56,10 @@ this release without warning.
56
56
  - The `#html` method has been removed from all color classes except Color::RGB.
57
57
 
58
58
  - Named RGB colors are no longer defined automatically, but must be loaded
59
- explicitly by requiring `color/rgb/colors`. This resolves [#30][issue-30].
59
+ explicitly by requiring `color/rgb/colors`. This resolves [#30][issue-30]. The
60
+ use of `Color::RGB#extract_colors`, `Color::RGB.by_hex`, `Color::RGB.by_name`,
61
+ or `Color::RGB.by_css` will require `color/rgb/colors` automatically as they
62
+ require the presence of the named colors.
60
63
 
61
64
  - `Color:CSS#[]` has been removed, as has the containing namespace. It has
62
65
  always been a shallow wrapper around `Color::RGB.by_name`.
data/lib/color/rgb.rb CHANGED
@@ -638,6 +638,7 @@ class << Color::RGB
638
638
  ##
639
639
  # Extract named or hex colors from the provided text.
640
640
  def extract_colors(text, mode = :both)
641
+ require "color/rgb/colors"
641
642
  text = text.downcase
642
643
  regex = case mode
643
644
  when :name
@@ -646,6 +647,8 @@ class << Color::RGB
646
647
  Regexp.union(__by_hex.keys)
647
648
  when :both
648
649
  Regexp.union(__by_hex.keys + __by_name.keys)
650
+ else
651
+ raise ArgumentError, "Unknown mode #{mode}"
649
652
  end
650
653
 
651
654
  text.scan(regex).map { |match|
@@ -683,11 +686,13 @@ class << Color::RGB
683
686
 
684
687
  ##
685
688
  def __by_hex # :nodoc:
689
+ require "color/rgb/colors"
686
690
  @__by_hex ||= {}
687
691
  end
688
692
 
689
693
  ##
690
694
  def __by_name # :nodoc:
695
+ require "color/rgb/colors"
691
696
  @__by_name ||= {}
692
697
  end
693
698
 
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.0.0.pre.0" # :nodoc:
4
+ VERSION = "2.0.0.pre.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.0.0.pre.0
4
+ version: 2.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler