{"id":13736886,"url":"https://github.com/treeform/chroma","last_synced_at":"2025-04-03T12:16:21.285Z","repository":{"id":30191868,"uuid":"124199981","full_name":"treeform/chroma","owner":"treeform","description":"Everything you want to do with colors, in Nim.","archived":false,"fork":false,"pushed_at":"2025-04-01T20:13:15.000Z","size":2496,"stargazers_count":106,"open_issues_count":0,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T21:25:28.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nim","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/treeform.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":"2018-03-07T07:56:45.000Z","updated_at":"2025-04-01T20:12:42.000Z","dependencies_parsed_at":"2024-01-06T12:02:54.295Z","dependency_job_id":"713a3f27-c327-493e-8459-b8f8c74a95a3","html_url":"https://github.com/treeform/chroma","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeform%2Fchroma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeform%2Fchroma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeform%2Fchroma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeform%2Fchroma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/treeform","download_url":"https://codeload.github.com/treeform/chroma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246998229,"owners_count":20866696,"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-08-03T03:01:30.619Z","updated_at":"2025-04-03T12:16:21.258Z","avatar_url":"https://github.com/treeform.png","language":"Nim","funding_links":[],"categories":["User Interface"],"sub_categories":["Design"],"readme":"\u003cimg src=\"docs/chromaBanner.png\"\u003e\n\n# Chroma - Everything you want to do with colors.\n\n* `atlas use chroma`\n* `nimble install chroma`\n\n![Github Actions](https://github.com/treeform/chroma/workflows/Github%20Actions/badge.svg)\n\n[API reference](https://treeform.github.io/chroma)\n\nThis library has no dependencies other than the Nim standard library.\n\n## About\n\nThis library works with colors and color spaces.\nEasily parse and transform colors.\nMany different color spaces. Optimized, fast and consistent.\n\n## Parse/Format\n\nCommon color parsers and formatters:\n* `hex` - `FFFFFF`\n* `HtmlHexTiny` - `#FFF`\n* `HtmlHex` - `#FFFFFF`\n* `HtmlRgb` - `rgb(255, 255, 255)`\n* `HtmlRgba` - `rgba(255, 255, 255, 1.0)`\n* `HtmlName` - `white`\n* `HexAlpha` - `FFFFFFFF`\n* `parseHtmlColor` - Any of the HTML formats.\n\n## Color Spaces\n\nConversion from and to these colors spaces:\n* 8-bit RGB\n* 8-bit RGBA\n* CMY colors are reverse of rgb\n* CMYK colors are used in printing\n* HSL attempts to resemble more perceptual color models\n* HSV models the way paints of different colors mix together\n* YUV origially a television color format, still used in digital movies\n* XYZ (CIE `XYZ`; CIE 1931 color space)\n* LAB (CIE `L*a*b*`, CIELAB), derived from XYZ (Note: a fixed white\n  point is assumed)\n* CIELCh, LAB in polar coordinates (type: `ColorPolarLAB`)\n* LUV (CIE `L*u*v*`, CIELUV), derived from XYZ (Note: a fixed white\n  point is assumed)\n* CIELCH, LUV in polar coordinates (type: `ColorPolarLUV`), often called HCL\n* Oklab (https://bottosson.github.io/posts/oklab/)\n\nThe default type is an RGB based type using `float32` as its base type\n(with values ranging from 0 to 1) and is called `Color`. All the above\ncolor spaces have corresponding type names of `Color\u003cColorSpaceName\u003e`,\nwhere `ColorSpaceName` is the name in the bullet points above (unless\nspecified by \"type:\" in parenthesis).\n\nConvenience procs to convert from and to the default type `Color` are\nprovided in the form of\n* `proc color(c: Color\u003cColorSpaceName\u003e): Color`\n\nand the inverse:\n* `proc \u003ccolorSpaceName\u003e(c: Color): Color\u003cColorSpaceName\u003e`.\n\nand using the field names:\n* `proc \u003ccolorSpaceName\u003e(\u003cfieldName1\u003e, \u003cfieldName2\u003e, \u003cfieldName3\u003e: \u003cfieldType\u003e): Color\u003cColorSpaceName\u003e`\n\n## Color Functions\n\nYou can use these to change colors you already have\n* `lighten(color, amout)` Lightens the color by amount 0-1\n* `darken(color, amout)` Darkens the color by amount 0-1\n* `saturate(color, amout)` Saturates (makes brighter) the color by amount 0-1\n* `desaturate(color, amout)` Desaturate (makes grayer) the color by amount 0-1\n* `spin(color, degrees)` Rotates the hue of the color by degrees (0-360)\n* `mix(colorA, colorB)` Mixes two colors together using CMYK\n\nA distance function is provided that implements\n[CIEDE2000 color difference formula](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000)\n* `distance(colorA, colorB)` Distance between two colors\n\nThis distance is designed to be perceptually uniform and it can be used to answer the question:\n\"What is a set of colors that are imperceptibly/acceptably close to a given reference?\".\nA value of 5.0 is used as reference in [github linguist library](https://github.com/github/linguist/):\nany color with distance less than 5.0 from one of the existing colors is not allowed.\n\n## Example\n\n```nim\nimport chroma\n\nlet\n    a = color(0.7,0.8,0.9)\n    b = color(0.2,0.3,0.4,0.5)\n\necho a.toHex()\necho parseHex(\"BADA55\")\necho parseHtmlName(\"red\")\necho hsv(b).color()\necho a.darken(0.2)\necho mix(a, b)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeform%2Fchroma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreeform%2Fchroma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeform%2Fchroma/lists"}