{"id":18705210,"url":"https://github.com/hsluv/hsluv-haxe","last_synced_at":"2026-01-27T10:10:43.172Z","repository":{"id":41535247,"uuid":"505643626","full_name":"hsluv/hsluv-haxe","owner":"hsluv","description":"Haxe implementation of HSLuv (revision 4)","archived":false,"fork":false,"pushed_at":"2023-05-05T03:56:37.000Z","size":579,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T06:28:00.449Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haxe","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}},"created_at":"2022-06-21T00:55:44.000Z","updated_at":"2023-08-23T22:51:23.000Z","dependencies_parsed_at":"2023-01-18T09:00:30.596Z","dependency_job_id":null,"html_url":"https://github.com/hsluv/hsluv-haxe","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-haxe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-haxe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-haxe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsluv%2Fhsluv-haxe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsluv","download_url":"https://codeload.github.com/hsluv/hsluv-haxe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239568070,"owners_count":19660610,"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:02.771Z","updated_at":"2025-11-09T05:30:33.609Z","avatar_url":"https://github.com/hsluv.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Run the test suite](https://github.com/hsluv/hsluv-haxe/actions/workflows/test.yml/badge.svg)](https://github.com/hsluv/hsluv-haxe/actions/workflows/test.yml)\n[![haxelib](https://img.shields.io/badge/haxelib-0.1.0-blue.svg)](https://lib.haxe.org/p/hsluv)\n\n# HSLuv - Haxe implementation\n\n## Usage\nOnce imported, use the library by importing HSLuv. Here's an example:\n\n```haxe\nimport hsluv.Hsluv;\n\nclass ReadmeTest {\n    public static function main() {\n        var conv = new Hsluv();\n        conv.hsluv_h = 10;\n        conv.hsluv_s = 75;\n        conv.hsluv_l = 65;\n        conv.hsluvToHex();\n        trace(conv.hex); // Will print \"#ec7d82\"\n    }\n}\n```\n\n### API functions\n\nThe API is designed in a way 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 from 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\n## Development\n\nRecommended editor: VS Code with [vshaxe](https://github.com/vshaxe/vshaxe/wiki) extension.\n\nNote that we have [automated Haxe transpilation to multiple targets](https://github.com/hsluv/hsluv-haxe/actions/workflows/transpile.yml).\n\n## Testing\n\nPrefered way: Haxe's builtin interpreter. Doesn't require any external libs to execute the tests:\n\n```sh\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 --interp\n```\n\nTest using Haxe's [compiler targets](https://haxe.org/documentation/introduction/compiler-targets.html):\n\n```sh\n# CPP Linux\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -cpp bin/cpp -cmd bin/cpp/RunTests\n# CPP Windows\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -cpp bin/cpp -cmd bin/cpp/RunTests.exe\n# C# Linux\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -cs bin/cs -cmd \"mono bin/cs/bin/RunTests.exe\"\n# C# Windows\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -cs bin/cs -cmd bin/cs/RunTests.exe\n# Java\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -java bin/java -cmd \"java -jar bin/java/RunTests.jar\"\n# PHP\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -php bin/php -cmd \"php bin/php/index.php\"\n# NodeJS\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -js bin/js/RunTests.js -cmd \"node bin/js/RunTests.js\"\n# Python\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -python bin/python/RunTests.py -cmd \"python3 bin/python/RunTests.py\"\n# Lua\nhaxe -cp src -cp test -main test.RunTests -resource test/snapshot-rev4.json@snapshot-rev4 -lua bin/lua/RunTests.lua -cmd \"lua bin/lua/RunTests.lua\"\n```\n\n## Generate snapshot\n\nWe only generate a new snapshot when we release a new revision of the color math. Then it can be used for testing this and other\nimplementations.\n\n```sh\nhaxe -cp src -cp test -main test.Snapshot --interp \u003e snapshot.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-haxe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsluv%2Fhsluv-haxe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsluv%2Fhsluv-haxe/lists"}