{"id":23674052,"url":"https://github.com/farism/rgbeef","last_synced_at":"2026-02-03T07:31:32.196Z","repository":{"id":75171077,"uuid":"560509386","full_name":"farism/RGBeef","owner":"farism","description":"Create, convert, and manipulate color spaces","archived":false,"fork":false,"pushed_at":"2022-11-02T05:56:35.000Z","size":123,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-05T23:37:12.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://farism.github.io/RGBeef/html","language":"Beef","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/farism.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-11-01T16:53:45.000Z","updated_at":"2025-05-09T19:03:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6092900-df0a-44ef-a709-81a5527192d3","html_url":"https://github.com/farism/RGBeef","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/farism/RGBeef","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2FRGBeef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2FRGBeef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2FRGBeef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2FRGBeef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farism","download_url":"https://codeload.github.com/farism/RGBeef/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2FRGBeef/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29037473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T06:39:36.383Z","status":"ssl_error","status_checked_at":"2026-02-03T06:39:32.787Z","response_time":96,"last_error":"SSL_read: 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":[],"created_at":"2024-12-29T12:59:13.745Z","updated_at":"2026-02-03T07:31:32.191Z","avatar_url":"https://github.com/farism.png","language":"Beef","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RGBeef - Everything you want to do with colors.\n\n[Reference Docs](https://farism.github.io/RGBeef/html/)\n\n## About\n\nWork with colors and color spaces. Easily parse and transform colors. Many different color spaces. Optimized, fast and consistent.\n\nThis library has no dependencies other than `Corlib`.\n\nHeavily inspired by [chroma](https://github.com/treeform/chroma)\n\n## Installing\n\n1. Clone this repo somewhere to your system.\n2. In the Beef IDE, right-click workspace panel select \"Add Existing Project\". Locate the directory you just cloned.\n3. For each project that will use `RGBeef`, right-click \u003e Properties \u003e Dependencies and check `RGBeef` as a dependency.\n\n## Usage\n\n```bf\nusing RGBeef;\n\nlet red = Color(1, 0, 0, 0); // create a color\n\nif(let green = Color.ParseHex(\"00FF00\")) // parse a hex value\n\nif(let blue = Color.ParseHtmlName(\"blue\")) // parse an html color name\n```\n\n## Parsing Color strings\n\nThe `Color` class has a handful of parsing methods for common string formats. All parsing methods return a `Result\u003cColor\u003e`.\n\n```bf\nif(let color = Color.ParseHex(\"FF0000\"))\n\n// ParseHtmlColor can handle various formats used in web\nif(let color = Color.ParseHtmlColor(\"rgba(255, 255, 255, 255)\"))\n```\n\n`static Result\u003cColor\u003e ParseHex(StringView string)) // FF0000` \n\n`static Result\u003cColor\u003e ParseHexAlpha(StringView string)) // FF0000FF` \n\n`static Result\u003cColor\u003e ParseHexTiny(StringView string)) // F00` \n\n`static Result\u003cColor\u003e ParseHtmlHex(StringView string)) // #FF0000` \n\n`static Result\u003cColor\u003e ParseHtmlHexTiny(StringView string)) // #F00` \n\n`static Result\u003cColor\u003e ParseHtmlRgb(StringView string)) // #rgb(255, 0, 0)` \n\n`static Result\u003cColor\u003e ParseHtmlRgba(StringView string)) // #rgb(255, 0, 0, 255)` \n\n`static Result\u003cColor\u003e ParseHtmlName(StringView string)) // red` \n\n`static Result\u003cColor\u003e ParseHtmlColor(StringView string)) // Any of the above html parsers` \n\n## Color Manipulations\n\n```bf\nlet lightRed = Color(1, 0, 0)..Lighten(0.5);\n```\n\nYou can manipulate `Color` values with the following methods:\n\n`void Lighten(float amount) // Lightens the color by amount 0-1`\n\n`void Darken(float amount) // Darkens the color by amount 0-1`\n\n`void Saturate(float amount) Saturates (makes brighter) the color by amount 0-1`\n\n`void Desaturate(float amount) // Desaturate (makes grayer) the color by amount 0-1`\n\n`void Spin(float degrees) // Rotates the hue of the color by degrees (0-360)`\n\n`void Mix(Color color) // Mixes two colors together`\n\n\n## Color Distance\n\n```bf\nlet d = Color(1, 0, 0).Distance(Color(.99999, 0, 0));\n```\n\n`Color` also implements a `Distance` method using [`CIEDE2000`](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000)\n\n`float Distance(Color color) // Calculate the distance between two colors`\n\n## Color Spaces\n\nRGBeef supports conversions from and to these colors spaces:\n\n- 8-bit RGB\n- 8-bit RGBA\n- CMY - Reverse of RGB\n- CMYK - 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 - Originally 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 point is assumed)\n- CIELCh, LAB in polar coordinates\n- LUV (CIE L*u*v*, CIELUV) - Derived from XYZ (Note: a fixed white point is assumed)\n- CIELCH, LUV in polar coordinates, often called HCL\n- Oklab (https://bottosson.github.io/posts/oklab/)\n\nThe default type is an RGB based type using `float` as its base type (with values ranging from 0 to 1) and is called `Color`.\n\nAll color spaces can be created directly by defining their component values:\n\n```bf\nlet rgb = RGB(255, 0, 0);\nlet rgba = RGBA(255, 0, 0);\n```\n\nOr created from a `Color`:\n\n```bf\nlet rgb = RGB(Color(1, 0, 0));\nlet rgba = RGBA(Color(1, 0, 0));\n```\n\nFor added ergonomics, `Color` has helper properties for easily converting to any color space:\n\n```bf\nRGB rgb = Color(1, 0, 0).rgb;\nRGBA rgba = Color(1, 0, 0, 0.5f).rgba;\n```\n\nAnd of course, the ability to convert back into a `Color`:\n\n```bf\nColor c1 = RGB(1, 0, 0).color;\nColor c2 = RGBA(1, 0, 0).color;\n```\n\nColor Spaces also come with support for the conversion properties that exist on `Color`:\n\n```bf\n// These are equivalent\nCMYK cmyk = RGBA(1, 0, 0, 0).color.cymk; \nCMYK cmyk = RGBA(1, 0, 0, 0).cymk; \n```\n\nAnd shorthand methods for parsing and manipulation:\n\n```bf\nRGB lightred = RGB(255, 0, 0)..Lighten(0.5); \n\nif(let cmyk = CMYK.ParseHtmlName(\"red\"))\n    cmyk.Darken(0.5); \n```\n\n[Check the tests for more](https://github.com/farism/RGBeef/src/Tests.bf)\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarism%2Frgbeef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarism%2Frgbeef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarism%2Frgbeef/lists"}