color_diff 0.1 → 0.2
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 +5 -5
- data/README.md +25 -19
- data/lib/color_diff/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b0fe61a7d235abdaf531ed9aed4b8f8e5d582880aac3934818b528dda4e3b6e5
|
|
4
|
+
data.tar.gz: 7a7ae004f39490604a2f5882341c2d71d25a854163ec9abc1aea2ad4a319cc3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d5619fecb9b42101e42955c1c8e2e2c70b568aa15b537814b871aa7f5319eba041fb7e27c32df331669e2ce121a12c1dca4e1e32bfa50919186696dc3be40b4
|
|
7
|
+
data.tar.gz: fa8d3a35a3742a9a6759d889feac9a3ef7cdf7fa0cef2bc4a617bb1c30edf08dba6314ddc9c63b4fff2342ab4b23c494f3148d043d6dfa5e778fe484e19b7c4f
|
data/README.md
CHANGED
|
@@ -10,32 +10,38 @@ Calculating differences between colors using the CIEDE2000 algorithm
|
|
|
10
10
|
|
|
11
11
|
Difference between two colors:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
```ruby
|
|
14
|
+
yellow = ColorDiff::Color::RGB.new 255, 255, 0
|
|
15
|
+
gold = ColorDiff::Color::RGB.new 255, 215, 0
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
ColorDiff.between yellow, gold
|
|
18
|
+
# => 11.584521223499245
|
|
19
|
+
```
|
|
18
20
|
|
|
19
21
|
Picking the most similar color from a list:
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
```ruby
|
|
24
|
+
red = ColorDiff::Color::RGB.new 255, 0, 0
|
|
25
|
+
blue = ColorDiff::Color::RGB.new 0, 0, 255
|
|
26
|
+
yellow = ColorDiff::Color::RGB.new 255, 255, 0
|
|
27
|
+
gold = ColorDiff::Color::RGB.new 255, 215, 0
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
list = ColorDiff::List.new [red, blue, yellow]
|
|
30
|
+
list.closest_to(gold) == yellow
|
|
31
|
+
# => true
|
|
32
|
+
```
|
|
29
33
|
|
|
30
34
|
Building a map of nearest match colors from a finite palette:
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
```ruby
|
|
37
|
+
red = ColorDiff::Color::RGB.new 255, 0, 0
|
|
38
|
+
black = ColorDiff::Color::RGB.new 0, 0, 0
|
|
39
|
+
dark_gray = ColorDiff::Color::RGB.new 80, 80, 80
|
|
40
|
+
maroon = ColorDiff::Color::RGB.new 128, 0, 0
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
list = ColorDiff::List.new [red, black]
|
|
43
|
+
palette = [dark_gray, maroon]
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
list.closest_to_map(palette)
|
|
46
|
+
# => { 'R255G0B0' => maroon, 'R0B0G0' => dark_gray }
|
|
47
|
+
```
|
data/lib/color_diff/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: color_diff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Hanson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-12-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -43,7 +43,7 @@ homepage: https://github.com/hansondr/color_diff
|
|
|
43
43
|
licenses:
|
|
44
44
|
- MIT
|
|
45
45
|
metadata: {}
|
|
46
|
-
post_install_message:
|
|
46
|
+
post_install_message:
|
|
47
47
|
rdoc_options: []
|
|
48
48
|
require_paths:
|
|
49
49
|
- lib
|
|
@@ -58,9 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '0'
|
|
60
60
|
requirements: []
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
signing_key:
|
|
61
|
+
rubygems_version: 3.5.22
|
|
62
|
+
signing_key:
|
|
64
63
|
specification_version: 4
|
|
65
64
|
summary: Calculate rgb color distances using CIEDE2000 formula
|
|
66
65
|
test_files: []
|