Skip to content

jsantell/interpolate-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interpolate-color

view example

A simple color interpolator component

Installation

$ component install jsantell/interpolate-color

Example Usage

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

About

A simple color interpolator component

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages