Find the color transition function between two colors
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin feat: add command-line interface Feb 4, 2017
demo
lib Fix arithmetic and tests Mar 30, 2016
test Fix arithmetic and tests Mar 30, 2016
.editorconfig
.gitignore Move demo to demo/ dir Jul 25, 2015
.jshintrc Lint demo code Jul 25, 2015
.npmignore chore: update npmignore Feb 4, 2017
CNAME Create CNAME Nov 10, 2015
Gruntfile.js fix: rename publish branch Oct 14, 2017
README.md
package.json

README.md

Cuttle

Ever wondered what color transformation to use to get from one color to another?

Say, #ae465f to #aeae46?

Cuttle got you covered.

Because that's what cephalopods do for one another.

API Reference

suggest(from, to[, preprocessor])

Suggests color functions that map from the from color to the to color.

Accepts an optional preprocessor parameter for the target preprocessor. Valid values are "less" and "sass". The default is "less".

Returns an array of suggestions, sorted by difference from the target color.

Example of suggesting LESS functions:

> cuttle.suggest("#000", "#333");

[ { difference: 0, format: "lighten(@input, 20%)" } ]

Example of suggesting SASS functions:

> cuttle.suggest("#ae465f", "#aeae46", "sass");

[ { difference: 0.4477, format: "adjust-hue($input, 75)" } ]

CLI Usage

Install as a global module through npm install -g cuttle. Then get suggestions by running

$ cuttle --from #ae465f --to #aeae46 --dialect sass

[ { difference: 0.4477, format: "adjust-hue($input, 75)" } ]

Full usage options:

Usage: cuttle [options]

Suggests transition functions between colors

Options:

  -h, --help               output usage information
  -V, --version            output the version number
  -f, --from <color>       input color (e.g. #ae465f)
  -t, --to <color>         output color (e.g. #aeae46)
  -d, --dialect <dialect>  dialect of output, either "sass" or "less"