colorama 0.1.0 → 0.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/.images/examples.jpg +0 -0
- data/README.md +8 -4
- data/colorama-0.1.0.gem +0 -0
- data/lib/colorama/color.rb +5 -7
- data/lib/colorama/color_extractor.rb +2 -2
- data/lib/colorama/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d913cbfd2e43bd8f111cc97213b42f7ca8affec13865a904ee513acab7f34c56
|
4
|
+
data.tar.gz: 8252cd9fe9e2ecbfc0b3679813b1c75b84bd8d936c79988928d51abdd0c2c483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 953bb0a49c35ea9ed79e84fe1e837566048c220def51746cf2bbfef820ae18c4c5f8729f2af1a362530e7e11979637e679f467c0f42e2b4580ba261baa5b6f1f
|
7
|
+
data.tar.gz: 26f9b874130c13e45c57b87a8127aca193f8db7d1a6cb8cd7d33266be07c54f4d157fafaedc0581b364b5a0e56cc3bdc1f1e57fb15ee327dbb05b7cc6f9b035b
|
Binary file
|
data/README.md
CHANGED
@@ -24,12 +24,12 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
The simplest usage is
|
27
|
+
The simplest usage is extracting the information from the image's file directly:
|
28
28
|
```ruby
|
29
29
|
colors = Colorama.extract_from_file('filename')
|
30
30
|
```
|
31
31
|
|
32
|
-
and it returns a `Hash`
|
32
|
+
and it returns a `Hash` containing the keys `background`, `primary`, `secondary` and `detail`.
|
33
33
|
|
34
34
|
---
|
35
35
|
|
@@ -40,6 +40,10 @@ colors = Colorama.extract_from_file('filename', detail: :high)
|
|
40
40
|
|
41
41
|
It accepts `lowest`, `low`, `high` and `highest`
|
42
42
|
|
43
|
+
## Examples
|
44
|
+
|
45
|
+

|
46
|
+
|
43
47
|
## Development
|
44
48
|
|
45
49
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -48,7 +52,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
48
52
|
|
49
53
|
## Contributing
|
50
54
|
|
51
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gustavodiel]/colorama. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gustavodiel/colorama/blob/master/CODE_OF_CONDUCT.md).
|
52
56
|
|
53
57
|
## License
|
54
58
|
|
@@ -56,4 +60,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
56
60
|
|
57
61
|
## Code of Conduct
|
58
62
|
|
59
|
-
Everyone interacting in the Colorama project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
63
|
+
Everyone interacting in the Colorama project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/gustavodiel/colorama/blob/master/CODE_OF_CONDUCT.md).
|
data/colorama-0.1.0.gem
ADDED
Binary file
|
data/lib/colorama/color.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'pry'
|
4
|
+
|
3
5
|
module Colorama
|
4
6
|
class Color
|
5
7
|
attr_reader :red, :green, :blue
|
@@ -27,13 +29,9 @@ module Colorama
|
|
27
29
|
|
28
30
|
def hex
|
29
31
|
@hex ||= begin
|
30
|
-
red_hex = red.to_s(16)
|
31
|
-
green_hex = green.to_s(16)
|
32
|
-
blue_hex = blue.to_s(16)
|
33
|
-
|
34
|
-
red_hex += red_hex unless red_hex.length == 2
|
35
|
-
green_hex += green_hex unless green_hex.length == 2
|
36
|
-
blue_hex += blue_hex unless blue_hex.length == 2
|
32
|
+
red_hex = red.to_s(16).rjust(2, '0')
|
33
|
+
green_hex = green.to_s(16).rjust(2, '0')
|
34
|
+
blue_hex = blue.to_s(16).rjust(2, '0')
|
37
35
|
|
38
36
|
"#{red_hex}#{green_hex}#{blue_hex}"
|
39
37
|
end
|
@@ -67,8 +67,8 @@ module Colorama::ColorExtractor
|
|
67
67
|
|
68
68
|
dark_background = proposed[0].dark_color?
|
69
69
|
|
70
|
-
|
71
|
-
proposed[i] = Colorama::Color.new_from_double(dark_background
|
70
|
+
(1..3).each do |i|
|
71
|
+
proposed[i] = Colorama::Color.new_from_double(dark_background ? 255_255_255 : 0) if proposed[i] == -1
|
72
72
|
end
|
73
73
|
|
74
74
|
{
|
data/lib/colorama/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colorama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Diel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- ".github/workflows/main.yml"
|
21
21
|
- ".gitignore"
|
22
|
+
- ".images/examples.jpg"
|
22
23
|
- ".rspec"
|
23
24
|
- ".rubocop.yml"
|
24
25
|
- CHANGELOG.md
|
@@ -30,6 +31,7 @@ files:
|
|
30
31
|
- Rakefile
|
31
32
|
- bin/console
|
32
33
|
- bin/setup
|
34
|
+
- colorama-0.1.0.gem
|
33
35
|
- colorama.gemspec
|
34
36
|
- lib/colorama.rb
|
35
37
|
- lib/colorama/color.rb
|