https://github.com/jsantell/interpolate-color
A simple color interpolator component
https://github.com/jsantell/interpolate-color
Last synced: 28 days ago
JSON representation
A simple color interpolator component
- Host: GitHub
- URL: https://github.com/jsantell/interpolate-color
- Owner: jsantell
- License: mit
- Created: 2013-06-13T06:09:51.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-06-18T08:33:22.000Z (almost 12 years ago)
- Last Synced: 2025-01-30T23:36:14.457Z (3 months ago)
- Language: JavaScript
- Homepage: http://jsantell.github.io/interpolate-color/
- Size: 160 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# interpolate-color
[view example](http://jsantell.github.io/interpolate-color)
A simple color interpolator component
## Installation
$ component install jsantell/interpolate-color
## Example Usage
```javascript
var interpolate = require('interpolate-color');
var red = 'hsl(0, 100%, 50%)';
var green = 'hsl(120, 100%, 50%)';interpolate(red, green, 0.5); // 'hsl(60, 100%, 50%)'
```## API
### interpolate(from, to, step, [precision])
- `from` the starting position HSL string (`hsl(0, 100%, 50%)`)
- `to` the end position HSL string
- `step` the normalized value (between 0 and 1) of the interpolation. A step of `0.5` would be the middle of `from` and `to`
- `precision` an optional argument of how many points of precision the results should have (default: `0`)## Tests
View `./test/index.html`
## License
MIT License