{"id":15556516,"url":"https://github.com/gforge/gradient-color","last_synced_at":"2025-03-29T03:22:43.698Z","repository":{"id":70448304,"uuid":"112120646","full_name":"gforge/gradient-color","owner":"gforge","description":"Make beautiful gradient color","archived":false,"fork":false,"pushed_at":"2017-11-30T17:28:49.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T13:15:34.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/gradient-color","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gforge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-11-26T22:09:36.000Z","updated_at":"2020-08-04T09:46:38.000Z","dependencies_parsed_at":"2023-02-27T16:15:32.611Z","dependency_job_id":null,"html_url":"https://github.com/gforge/gradient-color","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.1333333333333333,"last_synced_commit":"82f97f8a7dbf906d56871e350160a6f1184936f7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gforge%2Fgradient-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gforge%2Fgradient-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gforge%2Fgradient-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gforge%2Fgradient-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gforge","download_url":"https://codeload.github.com/gforge/gradient-color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246132128,"owners_count":20728436,"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-10-02T15:14:04.104Z","updated_at":"2025-03-29T03:22:43.681Z","avatar_url":"https://github.com/gforge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradient color\n\nGradient color generator\n\n**Attention**: This doc is for `v2.0`, `v1.x` usage is at the end of the doc, and it's deprecated\n\n## Installation\n\n`npm install gradient-color -S`\n\n## Usage\n\n```js\n// commonjs style\nconst gradient = require('gradient-color')\n// module import style\n// import gradient from 'gradient-color'\n\nconst colors = gradient([\n  '#E5404C',\n  '#FD743C',\n  '#FD9C3C'\n], 20)\n\n// array of 20 colors in `rgb(x, x, x)` format\nconsole.log(colors)\n```\n\n## API\n\n```js\ngradient(colorArray, n)\n```\nwhere\n\n- **colorArray** is either\n  - An array of color strings. This way, each gradient's step is the same\n  ```js\n  // hex string is supported\n  ['#fff', '#ddd', '#eee']\n  // rgb string is also ok\n  ['rgb(23, 23, 23)', 'rgb(33, 33, 33)']\n  ```\n  - An array of color object. You can specify each gradient's step value by `frac` field.\n  ```js\n  [\n    {\n      color: '#fff',\n      frac: 0.4\n    },\n    {\n      color: '#eee',\n      frac: 0.4\n    },\n    {\n      color: '#aaa',\n      frac: 0.2\n    },\n    // the last color could either be an object\n    {\n      color: '#fefefe'\n    }\n    // or a string value\n    // '#fefefe'\n  ]\n  ```\n  If you are using this method, there're several things you should remember:\n\n  1. **The last color should not have a `frac` field**, so it can be either an `Object` with only `color` field or a `String` value\n  2. **The sum of all the `frac`s should equal to 1**\n\n\n- **n** is the number of color that will be generated. **It should be greater than the length of your `colorArray`**, i.e. `n \u003e colorArray.length`\n\n\n## Upcoming features\n\n- [ ] Alpha channel support\n\n## Nasty old v1.x usage (deprecated)\n\n```js\nvar getGradient = require('gradient-color').getGradient\n\nvar number = 30 // How many units between the two colors\nvar startColor = \"#7e93f5\" // start color, must in hex mode\nvar endColor = \"#f32b65\" // end color, must in hex mode\n\nvar colors = getGradient(number, startColor, endColor)\n// output an array, each unit is a color string in \"rgb(r,g,b)\" format\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgforge%2Fgradient-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgforge%2Fgradient-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgforge%2Fgradient-color/lists"}