{"id":37184063,"url":"https://github.com/devinmcgloin/clr","last_synced_at":"2026-01-14T21:15:45.271Z","repository":{"id":57502346,"uuid":"95608682","full_name":"devinmcgloin/clr","owner":"devinmcgloin","description":"clr is a go library to manage different color spaces, convert between them and compare colors.","archived":false,"fork":false,"pushed_at":"2019-09-28T20:01:05.000Z","size":45,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T02:57:11.978Z","etag":null,"topics":["cielab","clr","color","golang","golang-library","hex","hsv","srgb"],"latest_commit_sha":null,"homepage":"https://devinmcgloin.com/clr/","language":"Go","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/devinmcgloin.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":"2017-06-27T23:16:45.000Z","updated_at":"2020-12-21T13:19:08.000Z","dependencies_parsed_at":"2022-09-13T07:01:57.916Z","dependency_job_id":null,"html_url":"https://github.com/devinmcgloin/clr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devinmcgloin/clr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinmcgloin%2Fclr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinmcgloin%2Fclr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinmcgloin%2Fclr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinmcgloin%2Fclr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devinmcgloin","download_url":"https://codeload.github.com/devinmcgloin/clr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinmcgloin%2Fclr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cielab","clr","color","golang","golang-library","hex","hsv","srgb"],"created_at":"2026-01-14T21:15:44.233Z","updated_at":"2026-01-14T21:15:45.230Z","avatar_url":"https://github.com/devinmcgloin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clr\n\n[![Build Status](https://travis-ci.org/devinmcgloin/clr.svg?branch=master)](https://travis-ci.org/devinmcgloin/clr)\n\nclr is a go library to manage different color spaces, convert between them and\ncompare colors.\n\nclr currently supports sRGB HSV, and Hex types, with conversions to sRGB, Hex, HSV,\nHSL, CMYK, XYZ and CIE-Lab for each.\n\nComparisons are done in CIE-Lab using Delta E*. I may add more comparison\noptions in the future, but for now Delta E* performs well enough.\n\nGiven a mapping from Hex to color names you can find the nearest color visually\nin the mapping from any given color. Data for these mappings is up to you to\nprovide by implementing `ColorTable`.\n\nThere is also a CLI tool to explore the package called `clr`.\n\n```\n$ clr --hex \"#0c6624\"\n\u0026{Code:0c6624}\nsRGB: 12 102 36\nHSL: 136 78 22\nHSV: 136 88 40\nCMYK: 88 0 64 60\nHEX: 0c6624\nGeneric Color: Green\nSpecific Color: Camarone\n```\n\n## API\n\nclr is based on two primitives `Color` and `ColorTable`. `Color` has three\nbacking types currently, Hex, RGB, and HSV. You can add your own types by\nimplementing the `Color` interface.\n\n```golang\ntype Color interface {\n\tValid() bool\n\tRGB() (int, int, int)\n\tHSL() (int, int, int)\n\tHSV() (int, int, int)\n\tCMYK() (int, int, int, int)\n\tXYZ() (float64, float64, float64)\n\tCIELAB() (l, a, b float64)\n\tHex() string\n\tColorName(colors ColorTable) ColorSpace\n\tDistance(c Color) float64\n\tRGBA() (r, g, b, a uint32)\n}\n```\n\nclr also contains functionality for finding the closest color name to a given\ncolor. This requires an instance of ColorTable, which provides the possible\ncolor matches. clr matches to the closest color in CIELAB.\n\n```golang\ntype ColorTable interface {\n\tIterate() []Color\n\tLookup(hexCode string) ColorSpace\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevinmcgloin%2Fclr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevinmcgloin%2Fclr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevinmcgloin%2Fclr/lists"}