{"id":20596051,"url":"https://github.com/davidfig/color","last_synced_at":"2026-04-20T11:03:29.156Z","repository":{"id":57404884,"uuid":"63805863","full_name":"davidfig/color","owner":"davidfig","description":"color javascript library","archived":false,"fork":false,"pushed_at":"2018-09-06T01:34:35.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T23:36:59.007Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/davidfig.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":"2016-07-20T18:46:58.000Z","updated_at":"2019-04-21T23:26:33.000Z","dependencies_parsed_at":"2022-09-03T19:30:43.861Z","dependency_job_id":null,"html_url":"https://github.com/davidfig/color","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/davidfig%2Fcolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidfig%2Fcolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidfig%2Fcolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidfig%2Fcolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidfig","download_url":"https://codeload.github.com/davidfig/color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242231436,"owners_count":20093636,"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-16T08:14:53.983Z","updated_at":"2026-04-20T11:03:29.106Z","avatar_url":"https://github.com/davidfig.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## random.js\na color API for working with colors defined as 0 - 0xffffff\n\n## rationale\nI wanted a simple function-based package to manipulate colors in either hex-string format '#ffffff' (for css) or hex-number format 0xffffff (for pixi.js)\n\n## Installation\n```\nnpm i yy-color\n```\n\n# API\n```js\n/**\n * converts a #FFFFFF to 0x123456\n * @param  {string} color\n * @return {string}\n */\nfunction poundToHex(color)\n\n/**\n * converts a 0x123456 to #FFFFFF\n * @param  {string} color\n * @return {string}\n */\nfunction hexToPound(color)\n\n/**\n * converts a number to #FFFFFF\n * @param  {number} color\n * @return {string}\n */\nfunction valueToPound(color)\n\n/**\n * based on tinycolor\n * https://github.com/bgrins/TinyColor\n * BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE\n * @param {string} color\n * @returns {object}\n */\nfunction hexToHsl (color)\n\n/** based on tinycolor\n* https://github.com/bgrins/TinyColor\n* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE\n* @param {object|number} color {h, s, b} or h\n* @param {number} [s]\n* @param {number} [l]\n* @returns number\n*/\nfunction hslToHex(color)\n\n/** based on tinycolor\n* https://github.com/bgrins/TinyColor\n* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE\n* @param {object} color\n* @param {number} amount\n*/\nfunction saturate(color, amount)\n\n/** based on tinycolor\n* https://github.com/bgrins/TinyColor\n* BSD license: https://github.com/bgrins/TinyColor/blob/master/LICENSE\n* @param {object} color\n* @param {number} amount\n*/\nfunction desaturate(color, amount)\n\n/**\n * blends two colors together\n * @param  {number} percent [0.0 - 1.0]\n * @param  {string} color1 first color in 0x123456 format\n * @param  {string} color2 second color in 0x123456 format\n * @return {number}\n */\nfunction blend(percent, color1, color2)\n\n/**\n * returns a hex color into an rgb value\n * @param  {number} hex\n * @return {string}\n */\nfunction hexToRgb(hex)\n\n/**\n * rgb color to hex in the form of 0x123456\n * @param  {(number|string)} r first number or 'rgb(...)' string\n * @param  {(number|null)} g\n * @param  {(number|null)} b\n * @return {string}\n */\nfunction rgbToHex(r, g, b)\n\n/**\n * returns a random color with balanced r, g, b values (i.e., r, g, b either have the same value or are 0)\n * @param {number} min value for random number\n * @param {number} max value for random number\n * @return {number} color\n */\nfunction random(min, max)\n\n/**\n * returns a random color based on hsl\n * @param {number} hMin [0, 360]\n * @param {number} hMax [hMin, 360]\n * @param {number} sMin [0, 1]\n * @param {number} sMax [sMin, 1]\n * @param {number} lMin [0, 1]\n * @param {number} lMax [lMin, 1]\n */\nfunction randomHSL(hMin, hMax, sMin, sMax, lMin, lMax)\n\n/**\n * returns random colors based on HSL with different hues\n * based on http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/\n * @returns {number[]} colors in hex format (0x123456)\n */\nfunction randomGoldenRatioHSL(count, saturation, luminosity)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidfig%2Fcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidfig%2Fcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidfig%2Fcolor/lists"}