Photoshop Scripting: Hue Shifting

669 Views Asked by At

I need to write a script to hue shift in photoshop. What i need is to shift the hue of the foreground color and change its darkness and assign this functionality to a keystroke. Is it possible?

1

There are 1 best solutions below

0
On

You can use a Hue Saturation Lightness shift:

function colourhsl(localRange, beginRamp, beginSustain, endSustain, endRamp, hue, sat, lum)
{
    var id25432 = charIDToTypeID( "HStr" );
    var desc1114 = new ActionDescriptor();
    var id25433 = charIDToTypeID( "Clrz" );
    desc1114.putBoolean( id25433, false );
    var id25434 = charIDToTypeID( "Adjs" );
    var list89 = new ActionList();
    var desc1115 = new ActionDescriptor();

    var id25435 = charIDToTypeID( "LclR" ); //local range
    desc1115.putInteger( id25435, localRange );
    var id25436 = charIDToTypeID( "BgnR" ); //begin ramp
    desc1115.putInteger( id25436, beginRamp );
    var id25437 = charIDToTypeID( "BgnS" ); //begin sustain
    desc1115.putInteger( id25437, beginSustain );
    var id25438 = charIDToTypeID( "EndS" ); //end sustain
    desc1115.putInteger( id25438, endSustain);
    var id25439 = charIDToTypeID( "EndR" ); //end ramp
    desc1115.putInteger( id25439, endRamp );

    //hue
    var id25440 = charIDToTypeID( "H   " );
    desc1115.putInteger( id25440, hue );

    //saturation
    var id25441 = charIDToTypeID( "Strt" );
    desc1115.putInteger( id25441, sat );

    //light
    var id25442 = charIDToTypeID( "Lght" );
    desc1115.putInteger( id25442, lum );

    var id25443 = charIDToTypeID( "Hst2" );
    list89.putObject( id25443, desc1115 );
    desc1114.putList( id25434, list89 );
    executeAction( id25432, desc1114, DialogModes.NO );
}

// example (localRange, beginRamp, beginSustain, endSustain, endRamp, hue, sat, lum)
//colourhsl(3,75,105,135,165,0,-100,0);