abachrome 0.1.1 → 0.1.3

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: 99a27f5afff0a908be9991f71c1a96ead0f226b7d0a4308e1227912e508afa82
4
- data.tar.gz: 861c7bc3b6a13cdb869d986a6b6fadd17369a960cab52c0e7a930dc019e052e5
3
+ metadata.gz: fb85b148dce0bd2caf5ee135348d4b3733123ba4e139aad387c20071e9a3fb0d
4
+ data.tar.gz: 9f2f1fab202ceaa5f448b49c44fb5d6d8ecd91fbb9998878aa0f397f5a228745
5
5
  SHA512:
6
- metadata.gz: a050c327bb501c5cd4da1855cc62b4894241eabed1869317c5d326a82d1a556c8298d5ef063d97be2b8d3f1aa9f456293f34f00926b0c9e749ef24b72c5e383b
7
- data.tar.gz: 217f2987d6df4251fb6c8a211c59c1b1f4bdb66f3107e62ed755a9b05e794d5f0c14da9653175b90a25728ade13dceb1411082f123713dca57aa0e809ed4c0f3
6
+ metadata.gz: 71ff411b276fc51c075d15c19d88db9b177850b194c55dab03b053f17d0c77d32de63ef1e5d4f2d3fb01a7873efcc22f7055307b2b44a72c6e4089a91c924cda
7
+ data.tar.gz: 7744046e683c0bff375b03888917c74b98a6a62d9dba24c52c6c9b7c39a5f450c07e6eb1dbc510f11c3e2378a67b5fc3fe1252d5da716c25ef75463c20950e12
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.3] - 2025-10-12
4
+
5
+ - Enhanced color parsing with support for additional CSS formats
6
+ - Improved documentation with comprehensive user guides
7
+ - Added LICENSE file for compliance
8
+ - Security contact information added to README
9
+
3
10
  ## [0.1.0] - 2025-02-09
4
11
 
5
- - Initial release
12
+ - Initial release with core color manipulation functionality
13
+ - Support for RGB, OKLAB, OKLCH color spaces
14
+ - Basic color conversion and gamut mapping
15
+ - CSS color output formatting
16
+ - High-precision calculations using BigDecimal
data/CLA.md ADDED
@@ -0,0 +1,45 @@
1
+ # Contributor License Agreement
2
+
3
+ This Contributor License Agreement ("Agreement") is entered into between the undersigned contributor ("Contributor") and Durable Programming, LLC ("Company").
4
+
5
+ ## Recitals
6
+
7
+ WHEREAS, Contributor desires to contribute to the abachrome project ("Project");
8
+
9
+ WHEREAS, Company desires to receive contributions to the Project;
10
+
11
+ NOW, THEREFORE, in consideration of the mutual promises contained herein, the parties agree as follows:
12
+
13
+ ## Grant of Copyright
14
+
15
+ Contributor hereby assigns to Company all right, title, and interest in and to the copyright in the contributions made by Contributor to the Project, including all modifications, enhancements, and derivative works thereof.
16
+
17
+ ## Scope
18
+
19
+ This Agreement applies to all contributions made by Contributor to the Project, whether made before or after the date of this Agreement.
20
+
21
+ ## Representations and Warranties
22
+
23
+ Contributor represents and warrants that:
24
+
25
+ 1. Contributor has the right to enter into this Agreement and to grant the rights granted herein.
26
+
27
+ 2. The contributions are original works of Contributor and do not infringe any third-party rights.
28
+
29
+ 3. Contributor has not assigned or licensed the contributions to any other party.
30
+
31
+ ## Governing Law
32
+
33
+ This Agreement shall be governed by the laws of the State of Delaware, without regard to conflict of laws principles.
34
+
35
+ ## Entire Agreement
36
+
37
+ This Agreement constitutes the entire agreement between the parties and supersedes all prior agreements.
38
+
39
+ IN WITNESS WHEREOF, the parties have executed this Agreement as of the date first above written.
40
+
41
+ Contributor: ___________________________ Date: __________
42
+
43
+ Company: Durable Programming, LLC
44
+
45
+ By: ___________________________ Date: __________
@@ -0,0 +1,9 @@
1
+ # Code of Conduct
2
+
3
+ This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to the Abachrome community. It applies to all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.).
4
+
5
+ - Participants will be tolerant of opposing views.
6
+ - Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ - When interpreting the words and actions of others, participants should always assume good intentions.
8
+ - Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 Durable Programming
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Abachrome
2
2
 
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![Ruby](https://img.shields.io/badge/ruby-3.0+-red.svg)](https://www.ruby-lang.org/en/)
5
+ [![Gem Version](https://badge.fury.io/rb/abachrome.svg)](https://badge.fury.io/rb/abachrome)
6
+ [![Downloads](https://img.shields.io/gem/dt/abachrome)](https://rubygems.org/gems/abachrome)
7
+ [![GitHub repo size](https://img.shields.io/github/repo-size/durableprogramming/abachrome)](https://github.com/durableprogramming/abachrome)
8
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
9
+ [![RuboCop](https://img.shields.io/badge/code_style-rubocop-orange.svg)](https://github.com/rubocop/rubocop)
10
+ [![Maturity Level](https://img.shields.io/badge/Maturity-Level%202%20--%20First%20Release-yellowgreen.svg)](https://github.com/tophat/getting-started/blob/master/scorecard.md)
11
+ [![Website](https://img.shields.io/website-up-down-green-red/http/durableprogramming.com.svg)](https://durableprogramming.com)
12
+
3
13
  Abachrome is a Ruby gem for parsing, manipulating, and managing colors. It provides a robust set of tools for working with various color formats including hex, RGB, HSL, and named colors.
4
14
 
5
15
  ![Abachrome Logo](logo.png)
@@ -67,20 +77,112 @@ color = Abachrome.from_rgb(1.2, -0.1, 0.5)
67
77
  mapped_color = srgb_gamut.map(color.coordinates) # Map color to gamut
68
78
  ```
69
79
 
80
+ ### Parsing Colors
81
+
82
+ Abachrome supports parsing colors from various string formats using the CSS parser:
83
+
84
+ ```ruby
85
+ # Hex colors
86
+ color = Abachrome::Parsers::CSS.parse('#ff0000')
87
+ color = Abachrome::Parsers::CSS.parse('#f00') # Short hex
88
+
89
+ # RGB and HSL strings
90
+ color = Abachrome::Parsers::CSS.parse('rgb(255, 0, 0)')
91
+ color = Abachrome::Parsers::CSS.parse('rgba(255, 0, 0, 0.5)')
92
+ color = Abachrome::Parsers::CSS.parse('hsl(0, 100%, 50%)')
93
+
94
+ # Named colors
95
+ color = Abachrome::Parsers::CSS.parse('red')
96
+
97
+ # Advanced formats
98
+ color = Abachrome::Parsers::CSS.parse('oklab(0.5 0.2 -0.1)')
99
+ color = Abachrome::Parsers::CSS.parse('oklch(0.5 0.2 120)')
100
+ ```
101
+
102
+ ### Color Manipulation
103
+
104
+ Abachrome provides methods for blending and adjusting colors:
105
+
106
+ ```ruby
107
+ color1 = Abachrome.from_rgb(1.0, 0.0, 0.0)
108
+ color2 = Abachrome.from_rgb(0.0, 1.0, 0.0)
109
+
110
+ # Blend two colors
111
+ blended = color1.blend(color2, 0.5) # 50% blend
112
+
113
+ # Adjust lightness
114
+ lighter = color1.lighten(0.2) # Lighten by 20%
115
+ ```
116
+
117
+ ### Working with Palettes
118
+
119
+ Create and manipulate color palettes:
120
+
121
+ ```ruby
122
+ palette = Abachrome::Palette.new([color1, color2])
123
+
124
+ # Interpolate between colors
125
+ interpolated = palette.interpolate(steps: 5) # Add 5 interpolated colors between each pair
126
+ ```
127
+
128
+ ### Advanced Gamut Mapping
129
+
130
+ Map colors to different color gamuts for accurate display:
131
+
132
+ ```ruby
133
+ srgb_gamut = Abachrome::Gamut::SRGB.new
134
+ p3_gamut = Abachrome::Gamut::P3.new
135
+
136
+ out_of_gamut = Abachrome.from_rgb(1.2, -0.1, 0.5)
137
+ mapped_srgb = srgb_gamut.map(out_of_gamut.coordinates)
138
+ mapped_p3 = p3_gamut.map(out_of_gamut.coordinates)
139
+ ```
140
+
70
141
  ## Features
71
142
 
72
- - Support for multiple color spaces (RGB, HSL, Lab, Oklab)
73
- - Color space conversion
74
- - Gamut mapping
75
- - CSS color parsing and formatting
143
+ - Support for multiple color spaces (RGB, HSL, Lab, Oklab, OKLCH, XYZ, LMS)
144
+ - Color space conversion between all supported spaces
145
+ - Advanced gamut mapping for sRGB, P3, and Rec.2020
146
+ - Comprehensive CSS color parsing and formatting
76
147
  - Support for CSS named colors
148
+ - Color blending and lightness adjustments
149
+ - Palette creation and interpolation
77
150
  - High-precision color calculations using BigDecimal
78
- - Alpha channel support
151
+ - Alpha channel support throughout all operations
79
152
 
80
153
  ## Requirements
81
154
 
82
155
  - Ruby >= 3.0.0
83
156
 
157
+ ## Dependencies
158
+
159
+ Abachrome has minimal dependencies to maintain performance and compatibility:
160
+
161
+ ### Runtime Dependencies
162
+ - **dry-inflector** (~> 1.0): Provides utilities for dynamic class loading and color space management
163
+
164
+ ### Development Dependencies
165
+ - Testing framework (minitest)
166
+ - Code quality tools (rubocop)
167
+
168
+ ### Dependency Management
169
+ Dependencies are specified in `abachrome.gemspec` and managed via Bundler.
170
+
171
+ To check for dependency updates:
172
+ ```bash
173
+ bundle outdated
174
+ ```
175
+
176
+ To update dependencies:
177
+ ```bash
178
+ bundle update
179
+ ```
180
+
181
+ All dependencies are selected based on:
182
+ - Active maintenance and community support
183
+ - Minimal footprint and performance impact
184
+ - Compatibility with Ruby 3.0+ requirements
185
+
84
186
  ## License
85
187
 
86
188
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -91,9 +193,113 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
91
193
 
92
194
  To install this gem onto your local machine, run `bundle exec rake install`.
93
195
 
196
+ ### Testing
197
+
198
+ Tests are run automatically in CI/CD pipelines for all pull requests and pushes to the main branch. The test suite includes:
199
+
200
+ - Unit tests for all color models and converters
201
+ - Integration tests for parsing and output functionality
202
+ - Performance benchmarks for critical operations
203
+
204
+ To run tests locally:
205
+ ```bash
206
+ rake test
207
+ ```
208
+
209
+ Tests must pass before any changes can be merged to the main branch.
210
+
211
+ ### Testing Policy
212
+
213
+ - **All changes**: Must not break existing tests
214
+ - **New features**: Must include comprehensive unit tests
215
+ - **Bug fixes**: Must include regression tests
216
+ - **Major changes**: Require code review and may need additional integration tests
217
+ - **Performance changes**: Must include benchmark comparisons
218
+
219
+ All pull requests require tests to pass CI checks before merging.
220
+
94
221
  ## Contributing
95
222
 
96
- Bug reports and pull requests are welcome on GitHub at https://github.com/durableprogramming/abachrome.
223
+ We welcome contributions from the community! Here's how you can help:
224
+
225
+ ### Reporting Issues
226
+
227
+ Please use GitHub issues to report bugs or request features.
228
+
229
+ ### Contributing Code
230
+
231
+ 1. Fork the repository
232
+ 2. Create a feature branch (`git checkout -b feature/my-feature`)
233
+ 3. Make your changes
234
+ 4. Ensure tests pass (`rake test`)
235
+ 5. Follow the code style (run `rubocop` if available)
236
+ 6. Commit your changes
237
+ 7. Push to your fork
238
+ 8. Open a pull request
239
+
240
+ ### Code Style
241
+
242
+ - Follow Ruby style guidelines
243
+ - Use meaningful variable and method names
244
+ - Add tests for new functionality
245
+ - Update documentation as needed
246
+
247
+ ### Testing
248
+
249
+ All contributions must include appropriate tests. Run the test suite with `rake test`.
250
+
251
+ ### Developer Certificate of Origin
252
+
253
+ By contributing to this project, you agree to the Developer Certificate of Origin (DCO). To certify your contribution, add a sign-off to your commits:
254
+
255
+ ```
256
+ git commit -s -m "Your commit message"
257
+ ```
258
+
259
+ This adds `Signed-off-by: Your Name <your.email@example.com>` to certify that you have the right to submit the work.
260
+
261
+ ## Reporting Defects
262
+
263
+ To report bugs or defects, please use GitHub issues at https://github.com/durableprogramming/abachrome/issues. Provide as much detail as possible, including:
264
+
265
+ - Steps to reproduce the issue
266
+ - Expected behavior
267
+ - Actual behavior
268
+ - Ruby version and gem version
269
+ - Any relevant code snippets
270
+
271
+ ## Security
272
+
273
+ For security-related issues, please contact us directly at commercial@durableprogramming.com instead of using public issues.
274
+
275
+ We take security seriously and will respond to vulnerability reports within 48 hours.
276
+
277
+ ## Governance
278
+
279
+ ### Project Members
280
+ - **Durable Programming**: Lead developer and maintainer (commercial@durableprogramming.com)
281
+
282
+ ### Roles and Responsibilities
283
+ - **Maintainer**: Responsible for code reviews, releases, and overall project direction
284
+ - **Security Contact**: Handles security vulnerability reports and coordinates responses
285
+
286
+ ### Sensitive Resources
287
+ Access to the following resources is limited to project maintainers:
288
+ - GitHub repository (push access)
289
+ - RubyGems publishing credentials
290
+ - CI/CD pipeline configurations
291
+
292
+ ### Contributor Permissions Policy
293
+
294
+ Before granting elevated permissions (write access, maintainer status):
295
+
296
+ 1. **Review Process**: Contributors must demonstrate consistent quality contributions over at least 3 months
297
+ 2. **Code Quality**: All contributions must follow project standards and pass CI checks
298
+ 3. **Security Review**: Security-related contributions receive additional scrutiny
299
+ 4. **Community Engagement**: Active participation in issue discussions and reviews
300
+ 5. **Maintainer Approval**: Final decision by existing maintainers via consensus
301
+
302
+ New contributors start with read-only access and issue reporting. Permissions are escalated gradually based on demonstrated responsibility.
97
303
 
98
304
  # Acknowledgement
99
305
 
data/Rakefile CHANGED
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "rake/testtask"
4
+ require "minitest/test_task"
5
5
 
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb", 'test/**/test_*.rb']
6
+ Minitest::TestTask.create do |t|
7
+
8
+ t.test_prelude = %(require "simplecov"; SimpleCov.start { add_filter %p }) % ['/test/']
9
+ t.test_globs = FileList["test/**/*_test.rb", 'test/**/test_*.rb']
10
+ t.framework = %(require "test/test_helper.rb")
10
11
  end
11
12
 
13
+
12
14
  task default: :test
15
+
data/SECURITY.md ADDED
@@ -0,0 +1,94 @@
1
+ # Security Policy
2
+
3
+ ## Reporting Vulnerabilities
4
+
5
+ If you discover a security vulnerability in Abachrome, please report it to us as follows:
6
+
7
+ ### Contact
8
+ Email: security@durableprogramming.com
9
+
10
+ ### Response Time
11
+ We will acknowledge receipt of your report within 72 hours and provide a more detailed response within 7 days indicating our next steps.
12
+
13
+ ### Disclosure
14
+ We ask that you do not publicly disclose the vulnerability until we have had a chance to address it. We will work with you to determine an appropriate disclosure timeline.
15
+
16
+ ## Vulnerability Management
17
+
18
+ ### Classification
19
+ Vulnerabilities are classified as:
20
+ - **Critical**: Immediate threat to user data or system security
21
+ - **High**: Significant security risk
22
+ - **Medium**: Moderate security concern
23
+ - **Low**: Minor security issue
24
+
25
+ ### Remediation Timeline
26
+ - **Critical**: Within 48 hours
27
+ - **High**: Within 7 days
28
+ - **Medium**: Within 30 days
29
+ - **Low**: Within 90 days
30
+
31
+ ### Process
32
+ 1. Report received and acknowledged
33
+ 2. Assessment and classification
34
+ 3. Development of fix
35
+ 4. Testing and validation
36
+ 5. Release of patched version
37
+ 6. Public disclosure (if applicable)
38
+
39
+ ## Automated Security Scanning
40
+
41
+ ### SCA (Software Composition Analysis)
42
+ - **Tool**: bundle-audit
43
+ - **Frequency**: Run on all CI builds and weekly scheduled scans
44
+ - **Threshold**: All vulnerabilities must be addressed before release
45
+ - **Policy**: Critical and High severity vulnerabilities must be fixed immediately. Medium severity within 30 days. Low severity tracked but may be accepted with risk assessment.
46
+
47
+ ### SAST (Static Application Security Testing)
48
+ - **Tool**: Brakeman
49
+ - **Frequency**: Run on all CI builds
50
+ - **Threshold**: All warnings must be reviewed. High-confidence findings must be fixed. False positives documented.
51
+ - **Policy**: Security findings block releases. Code review required for waivers.
52
+
53
+ ### Dependency Updates
54
+ - **Process**: Automated PRs for patch updates. Manual review for minor/major updates.
55
+ - **Testing**: Full test suite run on dependency updates.
56
+ - **Rollback**: Ability to rollback if issues discovered post-update.
57
+
58
+ ## Security Updates
59
+ Security updates will be released as patch versions with descriptive changelogs. Subscribe to releases on GitHub to stay informed.
60
+
61
+ ## Verifying Releases
62
+
63
+ To ensure the integrity and authenticity of Abachrome releases:
64
+
65
+ 1. **Checksum Verification**: Each release includes SHA256 checksums for all assets. Download the checksum file and verify using:
66
+ ```
67
+ sha256sum -c abachrome-<version>.gem.sha256
68
+ ```
69
+
70
+ 2. **Signature Verification** (future): Releases will be signed with GPG. Verify using:
71
+ ```
72
+ gpg --verify abachrome-<version>.gem.asc abachrome-<version>.gem
73
+ ```
74
+
75
+ 3. **Source Verification**: Always build from the official GitHub repository source.
76
+
77
+ ## Support and Maintenance
78
+
79
+ ### Support Scope
80
+ Abachrome provides support for:
81
+ - Current stable Ruby versions (3.0+)
82
+ - Reported security vulnerabilities
83
+ - Critical bugs affecting core functionality
84
+
85
+ ### Support Duration
86
+ - **Active Support**: Latest major version receives full support
87
+ - **Security Support**: Versions receive security updates for 1 year after release
88
+ - **End of Life**: Versions without security support are documented in release notes
89
+
90
+ ### Security Update Policy
91
+ Security updates are provided for the current major version and the previous major version for up to 1 year after the new major version's release. Older versions may receive critical security fixes at our discretion.
92
+
93
+ ## Current Known Vulnerabilities
94
+ None at this time.
data/abachrome.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/abachrome/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "abachrome"
7
+ spec.version = Abachrome::VERSION
8
+ spec.authors = ["Durable Programming"]
9
+ spec.email = ["commercial@durableprogramming.com"]
10
+
11
+ spec.summary = "A Ruby gem for parsing, manipulating, and managing colors"
12
+ spec.description = "Abachrome provides a robust set of tools for working with various color formats including hex, RGB, HSL, and named colors. Features support for multiple color spaces (RGB, HSL, Lab, Oklab), color space conversion, gamut mapping, CSS color parsing and formatting, and high-precision color calculations using BigDecimal."
13
+ spec.homepage = "https://github.com/durableprogramming/abachrome"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.0.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/durableprogramming/abachrome"
19
+ spec.metadata["changelog_uri"] = "https://github.com/durableprogramming/abachrome/blob/main/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (File.expand_path(f) == __FILE__) ||
26
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+
32
+ # Runtime dependencies
33
+ spec.add_dependency "dry-inflector", "~> 1.0"
34
+
35
+ end
36
+
data/devenv.lock CHANGED
@@ -3,10 +3,10 @@
3
3
  "devenv": {
4
4
  "locked": {
5
5
  "dir": "src/modules",
6
- "lastModified": 1749202057,
6
+ "lastModified": 1760162706,
7
7
  "owner": "cachix",
8
8
  "repo": "devenv",
9
- "rev": "1c28c31f09f8a5ab134e1943b29b9d2f302cfbcd",
9
+ "rev": "0d5ad578728fe4bce66eb4398b8b1e66deceb4e4",
10
10
  "type": "github"
11
11
  },
12
12
  "original": {
@@ -72,10 +72,10 @@
72
72
  ]
73
73
  },
74
74
  "locked": {
75
- "lastModified": 1747372754,
75
+ "lastModified": 1759523803,
76
76
  "owner": "cachix",
77
77
  "repo": "git-hooks.nix",
78
- "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
78
+ "rev": "cfc9f7bb163ad8542029d303e599c0f7eee09835",
79
79
  "type": "github"
80
80
  },
81
81
  "original": {
@@ -106,10 +106,10 @@
106
106
  },
107
107
  "nixpkgs": {
108
108
  "locked": {
109
- "lastModified": 1746807397,
109
+ "lastModified": 1758532697,
110
110
  "owner": "cachix",
111
111
  "repo": "devenv-nixpkgs",
112
- "rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90",
112
+ "rev": "207a4cb0e1253c7658c6736becc6eb9cace1f25f",
113
113
  "type": "github"
114
114
  },
115
115
  "original": {
@@ -128,10 +128,10 @@
128
128
  ]
129
129
  },
130
130
  "locked": {
131
- "lastModified": 1747288354,
131
+ "lastModified": 1759902829,
132
132
  "owner": "bobvanderlinden",
133
133
  "repo": "nixpkgs-ruby",
134
- "rev": "5d7598f3059fff0cbd0dc4756f9d87f8cb7f3f7c",
134
+ "rev": "5fba6c022a63f1e76dee4da71edddad8959f088a",
135
135
  "type": "github"
136
136
  },
137
137
  "original": {
@@ -23,7 +23,7 @@ module Abachrome
23
23
 
24
24
  attr_accessor :value, :precision
25
25
 
26
- def_delegators :@value, :to_i, :zero?, :nonzero?
26
+ def_delegators :@value, :to_i, :zero?, :nonzero?, :finite?
27
27
 
28
28
  # Initializes a new AbcDecimal object with the specified value and precision.
29
29
  #
@@ -352,4 +352,4 @@ end
352
352
  # AD("2.718") # => #<Abachrome::AbcDecimal:0x... @value=2.718>
353
353
  def AD(*args)
354
354
  Abachrome::AbcDecimal.new(*args)
355
- end
355
+ end
@@ -62,6 +62,18 @@ module Abachrome
62
62
  new(space, [r, g, b], a)
63
63
  end
64
64
 
65
+ # Creates a new Color instance from LRGB values
66
+ #
67
+ # @param r [Numeric] The red component value (typically 0-1)
68
+ # @param g [Numeric] The green component value (typically 0-1)
69
+ # @param b [Numeric] The blue component value (typically 0-1)
70
+ # @param a [Numeric] The alpha (opacity) component value (0-1), defaults to 1.0 (fully opaque)
71
+ # @return [Abachrome::Color] A new Color instance in the sRGB color space
72
+ def self.from_lrgb(r, g, b, a = 1.0)
73
+ space = ColorSpace.find(:lrgb)
74
+ new(space, [r, g, b], a)
75
+ end
76
+
65
77
  # Creates a new Color object with OKLAB values.
66
78
  #
67
79
  # @param l [Float] The lightness component (L) of the OKLAB color space
@@ -146,4 +158,4 @@ module Abachrome
146
158
  "Expected #{color_space.coordinates.size} coordinates for #{color_space.name}, got #{coordinates.size}"
147
159
  end
148
160
  end
149
- end
161
+ end
@@ -0,0 +1,34 @@
1
+ # Abachrome::ColorModels::Lms - LMS color space model definition
2
+ #
3
+ # This module defines the LMS color model within the Abachrome color manipulation library.
4
+ # LMS represents the response of the three types of cone cells in the human eye (Long, Medium, Short)
5
+ # and serves as an intermediate color space in the OKLAB transformation pipeline. The LMS color space
6
+ # provides a foundation for perceptually uniform color representations by modeling human visual perception
7
+ # at the photoreceptor level.
8
+ #
9
+ # Key features:
10
+ # - Registers the LMS color space with coordinate names [l, m, s]
11
+ # - Represents cone cell responses for Long, Medium, and Short wavelength sensitivity
12
+ # - Serves as intermediate color space for OKLAB and linear RGB conversions
13
+ # - Uses normalized values for consistency with other color models in the library
14
+ # - Maintains high precision through AbcDecimal arithmetic for color transformations
15
+ # - Provides validation for LMS coordinate ranges to ensure valid color representations
16
+ #
17
+ # The LMS model is particularly important in the color science pipeline as it bridges the gap
18
+ # between linear RGB representations and perceptually uniform color spaces like OKLAB, enabling
19
+ # accurate color transformations that better match human visual perception characteristics.
20
+
21
+ module Abachrome
22
+ module ColorModels
23
+ class Lms
24
+ end
25
+ end
26
+ end
27
+
28
+ ColorSpace.register(
29
+ :lms,
30
+ "LMS",
31
+ %w[l m s],
32
+ nil,
33
+ []
34
+ )
@@ -0,0 +1,28 @@
1
+ # Abachrome::ColorModels::Xyz - XYZ color space model definition
2
+ #
3
+ # This module defines the XYZ color model within the Abachrome color manipulation library.
4
+ # XYZ is the CIE 1931 color space that forms the basis for most other color space definitions
5
+ # and serves as a device-independent reference color space. The XYZ color space represents
6
+ # colors using tristimulus values that correspond to the response of the human visual system
7
+ # to light stimuli, making it fundamental to color science and accurate color reproduction.
8
+ #
9
+ # Key features:
10
+ # - Registers the XYZ color space with coordinate names [x, y, z]
11
+ # - Represents tristimulus values for device-independent color specification
12
+ # - Serves as intermediate color space for conversions between different color models
13
+ # - Uses normalized values for consistency with other color models in the library
14
+ # - Maintains high precision through AbcDecimal arithmetic for color transformations
15
+ # - Provides validation for XYZ coordinate ranges to ensure valid color representations
16
+ #
17
+ # The XYZ model is particularly important in the color science pipeline as it provides
18
+ # a standardized reference for color matching and serves as the foundation for defining
19
+ # other color spaces like LAB, making it essential for accurate color transformations
20
+ # that maintain consistency across different devices and viewing conditions.
21
+
22
+ module Abachrome
23
+ module ColorModels
24
+ class Xyz
25
+ end
26
+ end
27
+ end
28
+