{"id":18705201,"url":"https://github.com/hsluv/hsluv-javascript","last_synced_at":"2025-04-06T21:14:38.071Z","repository":{"id":49764340,"uuid":"509872157","full_name":"hsluv/hsluv-javascript","owner":"hsluv","description":"JavaScript implementation of HSLuv (revision 4)","archived":false,"fork":false,"pushed_at":"2025-03-30T17:03:11.000Z","size":562,"stargazers_count":31,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T17:34:45.474Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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","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":"2022-07-02T22:16:52.000Z","updated_at":"2025-03-30T16:59:03.000Z","dependencies_parsed_at":"2024-06-18T15:20:08.407Z","dependency_job_id":"a692b71c-78c5-4706-aae1-89e216c6be5c","html_url":"https://github.com/hsluv/hsluv-javascript","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"14b49e6cf9a9137916096b8487a5372626b57ba4"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsluv","download_url":"https://codeload.github.com/hsluv/hsluv-javascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550689,"owners_count":20956987,"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":[],"created_at":"2024-11-07T12:10:01.638Z","updated_at":"2025-04-06T21:14:38.045Z","avatar_url":"https://github.com/hsluv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HSLuv - Human-friendly HSL\n\n[![CI](https://github.com/hsluv/hsluv-javascript/actions/workflows/nodeci.yml/badge.svg)](https://github.com/hsluv/hsluv-javascript/actions/workflows/nodeci.yml)\n[![npm](https://img.shields.io/npm/v/hsluv)](https://www.npmjs.com/package/hsluv)\n\n## Installation\n\nInstall from NPM package repository:\n\n```bash\nnpm install hsluv\n```\n\nES modules:\n\n```javascript\nimport {Hsluv} from \"hsluv\";\n```\n\nCommonJS:\n\n```javascript\nconst {Hsluv} = require(\"hsluv\");\n```\n\nHTML include:\n\n- Download [the latest hsluv.min.js](https://github.com/hsluv/hsluv-javascript/releases)\n- Add `\u003cscript src=\"hsluv-x.x.x.min.js\"\u003e\u003c/script\u003e` to your HTML\n- Access it via the global `window.Hsluv`\n\n## Usage\n\nThe API is designed to avoid heap allocation. The `HSLuv` class defines the following public fields:\n\n- RGB: `hex:String`, `rgb_r:Float` [0;1], `rgb_g:Float` [0;1], `rgb_r:Float` [0;1]\n- CIE XYZ: `xyz_x:Float`, `xyz_y:Float`, `xyz_z:Float`\n- CIE LUV: `luv_l:Float`, `luv_u:Float`, `luv_v:Float`\n- CIE LUV LCh: `lch_l:Float`, `lch_c:Float`, `lch_h:Float`\n- HSLuv: `hsluv_h:Float` [0;360], `hsluv_s:Float` [0;100], `hsluv_l:Float` [0;100]\n- HPLuv: `hpluv_h:Float` [0;360], `hpluv_p:Float` [0;100], `hpluv_l:Float` [0;100]\n\nTo convert between color spaces, simply set the properties of the source color space, run the\nconversion methods, then read the properties of the target color space.\n\nUse the following methods to convert to and from RGB:\n\n- HSLuv: `hsluvToRgb()`, `hsluvToHex()`, `rgbToHsluv()`, `hexToHsluv()`\n- HPLuv: `hpluvToRgb()`, `hpluvToHex()`, `rgbToHpluv()`, `hexToHpluv()`\n\nUse the following methods to do step-by-step conversion:\n\n- Forward: `hsluvToLch()` (or `hpluvToLch()`), `lchToLuv()`, `luvToXyz()`, `xyzToRgb()`, `rgbToHex()`\n- Backward: `hexToRgb()`, `rgbToXyz()`, `xyzToLuv()`, `luvToLch()`, `lchToHsluv()` (or `lchToHpluv()`)\n\nFor advanced usage, we also export the [bounding lines](https://www.hsluv.org/math/) in slope-intercept\nformat, two for each RGB channel representing the limit of the gamut.\n\n- R \u003c 0: `r0s`, `r0i`\n- R \u003e 1: `r1s`, `r1i`\n- G \u003c 0: `g0s`, `g0i`\n- G \u003e 1: `g1s`, `g1i`\n- B \u003c 0: `b0s`, `b0i`\n- B \u003e 1: `b1s`, `b1i`\n\nExample:\n\n```javascript\nvar conv = new Hsluv();\nconv.hsluv_h = 10;\nconv.hsluv_s = 75;\nconv.hsluv_l = 65;\nconv.hsluvToHex();\nconsole.log(conv.hex); // Will print \"#ec7d82\"\n```\n\nAlso available for [Stylus](http://stylus-lang.com/). See [here](https://github.com/hsluv/hsluv-stylus).\n\n## Development\n\nOur [GitHub Actions workflow](https://github.com/hsluv/hsluv-javascript/blob/main/.github/workflows/nodeci.yml)\nwill build and test every push and PR to the `main` branch. When a `main` branch receives a commit that\nupdates the project version in `package.json`, the workflow will tag the commit, create a draft release\non GitHub and publish the npm package. Mark your versions with the `-rc` suffix to create pre-releases.\n\n## Changelog\n\n### 1.0.1\n\n- Fix TypeScript d.ts resolution for certain configurations.\n\n### 1.0.0\n\n- New API to avoid heap allocation.\n- Transpiled from [hsluv-haxe](https://github.com/hsluv/hsluv-haxe) and converted manually to TypeScript.\n- New GitHub Actions CI for build, test and publishing automation.\n\n### 0.1.0\n\n- Provide Typescript definitions in the NPM package.\n\n### 0.0.3\n\n- Expose intermediate functions in the public API.\n\n### 0.0.2\n\n- Improve packaging and minification.\n\n### 0.0.1\n\n- Initial release under the name HSLuv. Old releases can be found [here](https://www.npmjs.com/package/husl).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsluv%2Fhsluv-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-javascript/lists"}