color-curve-adjust
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

color-curve-adjust

Build Status Coverage

Performs a Photoshop/GIMP curve adjustment on a RGB color

Based on CSPL.js. Read more about the algorithm here.

Install

$ npm install color-curve-adjust

Usage

  • Edit your curve in Photoshop

    Photoshop curve

  • Create an array of each point of the curve

    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

    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

Dependents (0)

Package Sidebar

Install

npm i color-curve-adjust

Weekly Downloads

1

Version

3.0.1

License

MIT

Unpacked Size

23.7 kB

Total Files

12

Last publish

Collaborators

  • zed-k