Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexcambose/color-to-color
Transform color to color based on percentage
https://github.com/alexcambose/color-to-color
animation color hue shade transform
Last synced: about 1 month ago
JSON representation
Transform color to color based on percentage
- Host: GitHub
- URL: https://github.com/alexcambose/color-to-color
- Owner: alexcambose
- Created: 2018-12-22T21:01:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T20:06:54.000Z (almost 2 years ago)
- Last Synced: 2024-05-21T04:21:14.862Z (7 months ago)
- Topics: animation, color, hue, shade, transform
- Language: JavaScript
- Homepage: https://codesandbox.io/s/382j03rm86
- Size: 706 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# color-to-color
[![Coverage Status](https://coveralls.io/repos/github/alexcambose/color-to-color/badge.svg?branch=master)](https://coveralls.io/github/alexcambose/color-to-color?branch=master)
[![Build Status](https://travis-ci.org/alexcambose/color-to-color.svg?branch=master)](https://travis-ci.org/alexcambose/color-to-color)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)Transform _color to color_ based on percentage
[![Edit 382j03rm86](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/382j03rm86)
## Install
With [npm](https://www.npmjs.com/package/color-to-color)
```
npm i color-to-color -S
```## Usage
```js
const c2c = require("color-to-color");
const fromColor = 'red';
const toColor = 'blue';
c2c(fromColor).toColor(toColor).withPercent(50).get(); // { r: 127, g: 0, b: 127 }c2c(fromColor).toColor(toColor).withPercent(28).get('rgb'); // rgb(183, 0, 71)
c2c(fromColor).toColor(toColor).withPercent(50).get('hex'); // #7F007F
c2c(fromColor).toColor(toColor).withPercent(100).get('hsl'); // hsl(0, 0%, 255%)
c2c(fromColor).toColor(toColor).withPercent(84).get('hwb'); // hwb(40, 0%, 214%)c2c(fromColor).toColor(toColor).withPercent(0).get('keyword'); // red
c2c(fromColor).toColor(toColor).withPercent(100).get('keyword'); // blue
c2c(fromColor).toColor(toColor).withPercent(65).get('keyword'); // undefined
```## License
MIT