https://github.com/gyoshev/cuttle
Find the color transition function between two colors
https://github.com/gyoshev/cuttle
color-theme lesscss sass
Last synced: 11 months ago
JSON representation
Find the color transition function between two colors
- Host: GitHub
- URL: https://github.com/gyoshev/cuttle
- Owner: gyoshev
- Created: 2015-07-23T13:50:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-14T15:25:15.000Z (over 8 years ago)
- Last Synced: 2025-04-09T19:08:46.497Z (11 months ago)
- Topics: color-theme, lesscss, sass
- Language: JavaScript
- Homepage: http://ofcodeandcolor.com/cuttle/
- Size: 688 KB
- Stars: 39
- Watchers: 3
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cuttle
Ever wondered what color transformation to use to get from one color to another?
Say, `#ae465f` to `#aeae46`?
[Cuttle](http://ofcodeandcolor.com/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 input color (e.g. #ae465f)
-t, --to output color (e.g. #aeae46)
-d, --dialect dialect of output, either "sass" or "less"