{"id":18705196,"url":"https://github.com/hsluv/hsluv-ruby","last_synced_at":"2025-04-12T10:07:07.303Z","repository":{"id":34212675,"uuid":"38070245","full_name":"hsluv/hsluv-ruby","owner":"hsluv","description":"Ruby implementation of HSLuv (revision 3)","archived":false,"fork":false,"pushed_at":"2023-12-08T19:39:45.000Z","size":1084,"stargazers_count":20,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T10:05:05.423Z","etag":null,"topics":["color-palettes","colors","hpluv","hsluv","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hsluv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-25T19:44:10.000Z","updated_at":"2023-12-08T15:04:25.000Z","dependencies_parsed_at":"2023-12-08T16:24:54.655Z","dependency_job_id":"b921d546-c96a-47cf-951e-1ddc39118ae4","html_url":"https://github.com/hsluv/hsluv-ruby","commit_stats":{"total_commits":22,"total_committers":7,"mean_commits":3.142857142857143,"dds":"0.40909090909090906","last_synced_commit":"59354cf517fdd899cac17e8cb6f9c299a1850a52"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsluv","download_url":"https://codeload.github.com/hsluv/hsluv-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550634,"owners_count":21122933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color-palettes","colors","hpluv","hsluv","ruby"],"created_at":"2024-11-07T12:10:01.141Z","updated_at":"2025-04-12T10:07:07.260Z","avatar_url":"https://github.com/hsluv.png","language":"Ruby","readme":"[![Ruby](https://github.com/hsluv/hsluv-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/hsluv/hsluv-ruby/actions/workflows/ruby.yml)\n[![Gem Version](https://img.shields.io/gem/v/hsluv.svg)](https://rubygems.org/gems/hsluv)\n\nA Ruby implementation of [HSLuv](https://www.hsluv.org).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hsluv'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install hsluv\n\n## Usage\n\n- `hue` is a float between 0 and 360\n- `saturation` is a float between 0 and 100\n- `lightness` is a float between 0 and 100\n- `hex` is the hexadecimal format of the color\n- `red` is a float between 0 and 1\n- `green` is a float between 0 and 1\n- `blue` is a float between 0 and 1\n\n#### Hsluv::hsluv_to_hex(hue, saturation, lightness) -\u003e color as a hex string\n\n```ruby\nHsluv.hsluv_to_hex(12.177, 100, 53.23)\n=\u003e #ff0000\n```\n\n#### Hsluv::hsluv_to_rgb(hue, saturation, lightness) -\u003e color as rgb\n\n```ruby\nHsluv.hsluv_to_rgb(12.177, 100, 53.23)\n=\u003e [0.9998643703868711, 6.849859221502719e-14, 8.791283550555612e-06]\n```\n\n#### Hsluv::hex_to_hsluv(hex) -\u003e list of floats as defined above\n\n```ruby\nHsluv.hex_to_hsluv(\"#ff0000\")\n=\u003e [12.177050630061776, 100.0000000000022, 53.23711559542933]\n```\n\n#### Hsluv::rgb_to_hsluv(rgb) -\u003e list of floats as defined above\n\n```ruby\nHsluv.rgb_to_hsluv(0.99, 6.84e-14, 8.79e-16)\n=\u003e [12.17705063006216, 100.00000000000209, 52.711595266911985]\n```\n\nFor HPLuv (the pastel variant), use:\n\n- `hpluv_to_hex`\n- `hpluv_to_rgb`\n- `hex_to_hpluv`\n- `rgb_to_hpluv`\n\n## Local workflow\n\nIf you don't have Ruby installed already, I recommend using our [devcontainer.json](.devcontainer/devcontainer.json) configuration to launch your editor in a pre-built Ruby container. Also consider using GitHub \"Codespaces\" feature if you don't use Docker.\n\nInitial setup:\n\n```bash\nbundle install\n```\n\nTest:\n\n```bash\nbundle exec rspec\n```\n\n## Releasing a new version\n\n1. Log in to [rubygems.org](https://rubygems.org/) using our shared [hsluv](https://rubygems.org/profiles/hsluv) profile\n2. Make a new API key if necessary, copy it to GitHub Actions `HSLUV_RUBYGEMS_API_KEY` secret\n3. Update [hsluv.gemspec](./hsluv.gemspec) with new version, e.g. `1.0.2.rc1`, push to a branch\n4. Run [gem.yml workflow](https://github.com/hsluv/hsluv-ruby/actions/workflows/gem.yml) on that branch\n5. Sanity check: `gem install --user-install hsluv -v 1.0.2.rc1`\n\n## Version history\n\n1.0.2\n\n- Add HSLuv revision 4 support (thanks @felix-d)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsluv%2Fhsluv-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-ruby/lists"}