https://github.com/jzecca/color-curve-adjust
Performs a Photoshop/GIMP curve adjustment on a RGB color
https://github.com/jzecca/color-curve-adjust
color curve gimp npm-package photoshop
Last synced: 5 months ago
JSON representation
Performs a Photoshop/GIMP curve adjustment on a RGB color
- Host: GitHub
- URL: https://github.com/jzecca/color-curve-adjust
- Owner: jzecca
- License: mit
- Created: 2019-06-11T13:39:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-20T22:29:06.000Z (over 4 years ago)
- Last Synced: 2025-09-26T05:58:17.695Z (9 months ago)
- Topics: color, curve, gimp, npm-package, photoshop
- Language: TypeScript
- Homepage:
- Size: 124 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# color-curve-adjust
[](https://github.com/jzecca/color-curve-adjust/actions/workflows/ci.yaml)
[](https://codecov.io/gh/jzecca/color-curve-adjust)
> Performs a Photoshop/GIMP curve adjustment on a RGB color
Based on [CSPL.js](https://github.com/kuckir/CSPL.js).
Read more about the algorithm [here](http://blog.ivank.net/interpolation-with-cubic-splines.html).
## Install
```
$ npm install color-curve-adjust
```
## Usage
- Edit your curve in Photoshop

- Create an array of each point of the curve
```ts
const curve = [
{ x: 0, y: 85 },
{ x: 50, y: 120 },
{ x: 140, y: 200 },
{ x: 190, y: 225 },
{ x: 255, y: 255 },
];
```
- Import the module and call it with a color and your array
```ts
import curveAdjust from 'color-curve-adjust';
curveAdjust('#5a2149', curve);
//=> '#9d6b8d'
curveAdjust('#5a2149', curve, 'r'); // adjust only the red channel
//=> '#9d2149'
curveAdjust('#5a2149', curve, 'gb'); // adjust only green & blue channels
//=> '#5a6b8d'
```
## License
MIT © [Jérôme Zecca](https://zed-k.com)