{"id":17621150,"url":"https://github.com/noeldelgado/mix-css-color","last_synced_at":"2025-04-30T17:21:29.642Z","repository":{"id":42462933,"uuid":"265150900","full_name":"noeldelgado/mix-css-color","owner":"noeldelgado","description":":alembic: Mix two colors together in variable proportion. Opacity is included in the calculations.","archived":false,"fork":false,"pushed_at":"2023-01-08T14:09:01.000Z","size":369,"stargazers_count":13,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T08:25:29.958Z","etag":null,"topics":["alpha","color","css","hex","hsl","hsla","mix","opacity","rgb","rgba","string"],"latest_commit_sha":null,"homepage":"","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/noeldelgado.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-05-19T05:08:38.000Z","updated_at":"2024-11-19T03:48:12.000Z","dependencies_parsed_at":"2023-02-08T06:16:31.562Z","dependency_job_id":null,"html_url":"https://github.com/noeldelgado/mix-css-color","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noeldelgado%2Fmix-css-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noeldelgado%2Fmix-css-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noeldelgado%2Fmix-css-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noeldelgado%2Fmix-css-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noeldelgado","download_url":"https://codeload.github.com/noeldelgado/mix-css-color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251749114,"owners_count":21637456,"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":["alpha","color","css","hex","hsl","hsla","mix","opacity","rgb","rgba","string"],"created_at":"2024-10-22T20:11:22.599Z","updated_at":"2025-04-30T17:21:29.615Z","avatar_url":"https://github.com/noeldelgado.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mix-css-color\n[![npm version][npm-img]][npm-url]\n![](https://img.badgesize.io/noeldelgado/mix-css-color/master/index.js.svg?compression=gzip)\n[![License][license-img]][license-url]\n[![codecov][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-img]][snyk-url]\n[![Libraries.io dependency status for latest release][librariesio-img]][librariesio-url]\n[![Total alerts][lgtm-image]][lgtm-url]\n[![Language grade: JavaScript][lgtm-grade-image]][lgtm-grade-url]\n\nMix two colors together in variable proportion. Opacity is included in the calculations.\n\n_Output should be similar to the `less`/`sass` `mix()` function._\n\n### Supports\n* \\\u003ccolor value\\\u003e\n\t* Hexadecimal RGB value: #RGB #RRGGBB\n\t* #RGBA #RRGGBBAA (4 and 8-digit hexadecimal RGBA notation)\n\t* RGB/A color module level 3 and 4 (number, percentage)\n\t* HSL/A color module level 3 and 4 (number, deg, rad, turn)\n* \\\u003ccolor keyword\\\u003e\n\t* One of the [pre-defined color keywords](https://www.w3.org/wiki/CSS/Properties/color/keywords).\n* transparent\n\t* Shorthand for transparent black, rgba(0,0,0,0).\n\n### Does not support\n* currentColor\n* inherit\n\n## Installation\n\n**NPM**\n\n```sh\nnpm i mix-css-color\n```\n\nOr as a `\u003cscript\u003e` tag from a CDN as `mixCssColor`:\n\n**Unpkg CDN**\n\n```html\n\u003cscript src=\"https://unpkg.com/mix-css-color\"\u003e\u003c/script\u003e\n```\n\n**jsDelivr CDN**\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/mix-css-color\"\u003e\u003c/script\u003e\n```\n\n## Usage\n```js\nimport mix from 'mix-css-color'\n\nmix('rgb(255 255 255 / 1)', 'red') // default 50% mix\n//\u003e {rgba: [255, 128, 128, 1], hsla: [0, 100, 75, 1], hex: '#ff8080', hexa: '#ff8080ff' }\n\nmix('black', 'rgba(255, 0, 0, 0.22)', 22) // 22% mix\n//\u003e { rgba: [78, 0, 0, 0.3916], hsla: [0, 100, 15, 0.3916], hex: '#4e0000', hexa: '#4e000064' }\n\nmix('rgba(100% 255 100% / 0)') // error: mixed percetange with integer\n//\u003e null\n```\nSee [tests](https://github.com/noeldelgado/mix-css-color/tree/master/test) for more cases.\n\n## API\n### mix(color1:string, color2: string, [percentage: number=50])\n- @param color1 - CSS string\n- @param color2 - CSS string\n- @param [percentage=50] - a number within 0 and 100\n\n## Dev\n```sh\nnpm install   # install dependencies\nnpm test      # run the tests\nnpm run dev   # watch for changes and rebuild\n```\n\n## Related\n- [parse-css-color](https://github.com/noeldelgado/parse-css-color) - Parse a CSS color string\n- [values.js](https://github.com/noeldelgado/values.js) - Get the tints and shades of a CSS color\n\n## License\nMIT © [Noel Delgado](http://pixelia.me/)\n\n[npm-img]: https://img.shields.io/npm/v/mix-css-color.svg?logo=npm\u0026label=NPM\n[license-img]: https://img.shields.io/npm/l/mix-css-color\n[license-url]: https://github.com/noeldelgado/mix-css-color/blob/master/LICENSE\n[codecov-image]: https://codecov.io/gh/noeldelgado/mix-css-color/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/noeldelgado/mix-css-color\n[npm-url]: https://www.npmjs.com/package/mix-css-color\n[snyk-img]: https://snyk.io/test/npm/mix-css-color/badge.svg\n[snyk-url]: https://snyk.io/test/npm/mix-css-color\n[librariesio-img]: https://img.shields.io/librariesio/release/npm/mix-css-color.svg?logo=librariesdotio\n[librariesio-url]: https://libraries.io/npm/mix-css-color\n[lgtm-image]: https://img.shields.io/lgtm/alerts/g/noeldelgado/mix-css-color.svg?logo=lgtm\u0026logoWidth=18\n[lgtm-url]: https://lgtm.com/projects/g/noeldelgado/mix-css-color/alerts/\n[lgtm-grade-image]: https://img.shields.io/lgtm/grade/javascript/g/noeldelgado/mix-css-color.svg?logo=lgtm\u0026logoWidth=18\n[lgtm-grade-url]: https://lgtm.com/projects/g/noeldelgado/mix-css-color/context:javascript","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoeldelgado%2Fmix-css-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoeldelgado%2Fmix-css-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoeldelgado%2Fmix-css-color/lists"}