{"id":20722474,"url":"https://github.com/toomanybees/lab","last_synced_at":"2025-08-21T03:15:50.977Z","repository":{"id":48347273,"uuid":"80320277","full_name":"TooManyBees/lab","owner":"TooManyBees","description":"RGB \u003c-\u003e Lab color space conversion","archived":false,"fork":false,"pushed_at":"2021-07-30T18:05:32.000Z","size":171,"stargazers_count":15,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-24T05:54:28.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/lab","language":"Rust","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/TooManyBees.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-01-29T00:22:18.000Z","updated_at":"2024-03-31T00:25:57.000Z","dependencies_parsed_at":"2022-09-01T17:50:53.539Z","dependency_job_id":null,"html_url":"https://github.com/TooManyBees/lab","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Flab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Flab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Flab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TooManyBees%2Flab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TooManyBees","download_url":"https://codeload.github.com/TooManyBees/lab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250464299,"owners_count":21434972,"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-17T03:36:00.830Z","updated_at":"2025-04-23T15:47:54.957Z","avatar_url":"https://github.com/TooManyBees.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lab\n\n[![Lab crate](https://img.shields.io/crates/v/lab.svg)](https://crates.io/crates/lab)\n[![Lab documentation](https://docs.rs/lab/badge.svg)](https://docs.rs/lab)\n![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.36+-red.svg)\n[![TravisCI Build Status](https://travis-ci.com/TooManyBees/lab.svg)](https://travis-ci.com/github/TooManyBees/lab)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/TooManyBees/lab?branch=master\u0026svg=true)](https://ci.appveyor.com/project/TooManyBees/lab)\n\nTools for converting RGB colors to L\\*a\\*b\\* measurements.\n\nRGB colors, for this crate at least, are considered to be composed of `u8`\nvalues from 0 to 255, while L\\*a\\*b\\* colors are represented by its own struct\nthat uses `f32` values.\n\n# Usage\n\n## Converting single values\n\nTo convert a single value, use one of the functions\n\n* `lab::Lab::from_rgb(rgb: \u0026[u8; 3]) -\u003e Lab`\n* `lab::Lab::from_rgba(rgba: \u0026[u8; 4]) -\u003e Lab` (drops the fourth alpha byte)\n* `lab::Lab::to_rgb(\u0026self) -\u003e [u8; 3]`\n\n```rust\nextern crate lab;\nuse lab::Lab;\n\nlet pink_in_lab = Lab::from_rgb(\u0026[253, 120, 138]);\n// Lab { l: 66.639084, a: 52.251457, b: 14.860654 }\n```\n\n## Converting multiple values\n\nTo convert slices of values\n\n* `lab::rgbs_to_labs(rgbs: \u0026[[u8; 3]]) -\u003e Vec\u003cLab\u003e`\n* `lab::labs_to_rgbs(labs: \u0026[Lab]) -\u003e Vec\u003c[u8; 3]\u003e`\n* `lab::rgb_bytes_to_labs(bytes: \u0026[u8]) -\u003e Vec\u003cLab\u003e`\n* `lab::labs_to_rgb_bytes(labs: \u0026[Lab]) -\u003e Vec\u003cu8\u003e`\n\n```rust\nextern crate lab;\nuse lab::rgbs_to_labs;\n\nlet rgbs = vec![\n    [0xFF, 0x69, 0xB6],\n    [0xE7, 0x00, 0x00],\n    [0xFF, 0x8C, 0x00],\n    [0xFF, 0xEF, 0x00],\n    [0x00, 0x81, 0x1F],\n    [0x00, 0xC1, 0xC1],\n    [0x00, 0x44, 0xFF],\n    [0x76, 0x00, 0x89],\n];\n\nlet labs = rgbs_to_labs(\u0026rgbs);\n```\n\n```rust\nextern crate lab;\nuse lab::rgb_bytes_to_labs;\n\nlet rgbs = vec![\n    0xFF, 0x69, 0xB6,\n    0xE7, 0x00, 0x00,\n    0xFF, 0x8C, 0x00,\n    0xFF, 0xEF, 0x00,\n    0x00, 0x81, 0x1F,\n    0x00, 0xC1, 0xC1,\n    0x00, 0x44, 0xFF,\n    0x76, 0x00, 0x89,\n];\n\nlet labs = rgb_bytes_to_labs(\u0026rgbs);\n```\n\nThese functions will use x86_64 AVX2 instructions if compiled to a supported target.\n\n## Minimum Rust version\n\nLab 0.8.0 requires Rust \u003e= 1.36.0 for the [MaybeUninit](https://doc.rust-lang.org/std/mem/union.MaybeUninit.html) struct\n\nLab 0.7.0 requires Rust \u003e= 1.31.0 for the [chunks_exact](https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact) slice method\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Flab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoomanybees%2Flab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoomanybees%2Flab/lists"}