{"id":13525469,"url":"https://github.com/WetDesertRock/vivid","last_synced_at":"2025-04-01T05:31:30.686Z","repository":{"id":75705883,"uuid":"40200877","full_name":"WetDesertRock/vivid","owner":"WetDesertRock","description":"Vivid is a simple lua library for dealing with simple color math.","archived":false,"fork":false,"pushed_at":"2020-03-25T21:45:47.000Z","size":29,"stargazers_count":59,"open_issues_count":2,"forks_count":3,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-20T07:44:21.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/WetDesertRock.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}},"created_at":"2015-08-04T18:08:19.000Z","updated_at":"2025-01-13T12:04:45.000Z","dependencies_parsed_at":"2023-06-07T10:30:24.503Z","dependency_job_id":null,"html_url":"https://github.com/WetDesertRock/vivid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WetDesertRock%2Fvivid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WetDesertRock%2Fvivid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WetDesertRock%2Fvivid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WetDesertRock%2Fvivid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WetDesertRock","download_url":"https://codeload.github.com/WetDesertRock/vivid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246591200,"owners_count":20801981,"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-01T06:01:19.089Z","updated_at":"2025-04-01T05:31:27.728Z","avatar_url":"https://github.com/WetDesertRock.png","language":"Lua","funding_links":[],"categories":["Libraries","Helpers"],"sub_categories":["Programming Language"],"readme":"# vivid.lua\n\nOne file simple color manipulation library. Used for color conversion and math.\n\nAll functions can take an `alpha` after the three components of a color. This variable is not modified, but passed through for convenience. Whenever you pass a color, you can either pass a table or an unpacked list of arguments.\n\nIncluded in this repository is a simple example using Quickie that demonstrates the uses of this library. It can also serve as a tool if you need a good color picking utility for when you use this library. If it has problems finding vivid you will either need to make a symlink or just copy the file over.\n\nAll conversion formulas are taken from [EasyRGB] with the exception of [HuSL] (which is not included yet).\n\n## Available Colorspaces\nThis library works in the following colorspaces:\n * RGB (0-1)\n * HSL (0-1)\n * HSV (0-1)\n * XYZ\n * CIE L*ab (Known as `Lab` in the code)\n * CIE-L*CH (Known as `LCH` in the code)\n * CIE-L*uv (Known as `Luv` in the code)\n\n And hopefully soon:\n * HuSL (not supported, I do not want to decipher coffeescript just yet)\n\n## Conversion from RGB\n\n### vivid.RGBto`colorspace`(r,g,b,a)\nReturns the four components of `colorspace`.\n```lua\nprint(vivid.RGBtoHSL(10,20,10,100))\n```\n\n\n## Conversion to RGB\n\n### vivid.`colorspace`toRGB(h,s,l,alpha)\nReturn `r`,`g`,`b`,`a` components of the `colorspace` input.\n```lua\nprint(vivid.HSVtoRGB(0,1,0.5))\n```\n\n## Additional Conversion Functions\n### vivid.XYZtoLab(x,y,z,alpha)\n### vivid.LabtoXYZ(l,a,b,alpha)\n### vivid.XYZtoLuv(x,y,z,alpha)\n### vivid.LuvtoXYZ(l,u,v,alpha)\n### vivid.LabtoLCH(l,a,b,alpha)\n### vivid.LCHtoLab(l,c,h,alpha)\n\n## Color Manipulations\nMost of these manipulations take `color` which looks like `{r,g,b,a}` or just four more arguments `r,g,b,a`, performs the operation, and returns the modified color. Color spaces used are chosen due to my somewhat limited understanding on how each performs.\n### vivid.lighten(amount, color)\nUses the HSL colorspace.\n### vivid.darken(amount, color)\nUses the HSL colorspace.\n### vivid.saturate(amount, color)\nUses the HSV colorspace.\n### vivid.desaturate(amount, color)\nUses the HSV colorspace.\n### vivid.hue(hue, color)\nSets the hue using HSL.\n### vivid.invert(color)\nInverts the color using simple RGB inversion.\n### vivid.invertHue(color)\nInverts the color using simple `1-hue` inversion in HSL.\n\n\n## Utility Functions\n\n### vivid.HSVSpread(count,hoffset,s,l,a)\n### vivid.HSLSpread(count,hoffset,s,v,a)\n### vivid.LCHSpread(count,l,c,hoffset,a)\nThese functions return an even spread of colors across a color space. It will take evenly spaced h values across the whole colorspace and use the other given values for colors. Useful for quick and easy color scheme generation for random colors and such.\n`count` is how many colors you want, and `hoffset` is the hue offset.\n\n### vivid.wrap`colorspace`(fn)\nWraps fn that may normally take RGBA arguments to take `colorspace` argument.\n\n[EasyRGB]: http://www.easyrgb.com/?X=MATH\n[HuSL]: https://github.com/husl-colors/husl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWetDesertRock%2Fvivid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWetDesertRock%2Fvivid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWetDesertRock%2Fvivid/lists"}