Skip to main content
Mortisfilm
Known Participant
February 4, 2017
Question

Keyboard shortcut for changing stroke color?

  • February 4, 2017
  • 2 replies
  • 3178 views

Hi all,

Working on some files that require me to create numerous stroked shape layers -- I can easily change the "fill" color by using the "option + delete" keyboard shortcut.

Is there currently a "fill" keyboard shortcut where I can similarly easily change the color of the stroked outline of these shape layers? I've tried creating my own keyboard shortcut for this, but I can't seem to find the right place in "Keyboard Shortcuts and Menus" where I can create my own shortcut.

I've also tried setting up a custom "action" for this (where the stroke layer would change color to whatever color is selected in my color palette), but it won't record this when I try to create it.

Thanks and apologies if this has been asked & answered before, I tried looking for similar questions but couldn't find any.

    This topic has been closed for replies.

    2 replies

    c.pfaffenbichler
    Community Expert
    Community Expert
    February 10, 2017

    At the very least one could create a Script that changes the Stroke Color to the Foreground Color.

    One could also create a dialog for color-picking, I guess.

    Mortisfilm
    Known Participant
    February 10, 2017

    Thanks for the reply.

    I have some experience creating actions, but not scripts.

    I tried to create an action to change the stroke color to the Foreground Color, unfortunately the action just saves whatever specific color happens to be the foreground color at the time I create the action, so once I need to use a different color, the action changes the color of my stroke to the specific color that was in the foreground at the time I created the action, instead of the new color I've chosen.

    I would like to try and create a script for this, though. Can you recommend a good resource to learn about creating scripts? Thanks!

    c.pfaffenbichler
    Community Expert
    Community Expert
    February 12, 2017

    Can you recommend a good resource to learn about creating scripts?

    Not for Photoshop.

    But install ESTK and start with »Adobe Intro To Scripting.pdf« and »photoshop-cc-scripting-guide.pdf«

    And when you hit a problem ask for advice/help over on the Photoshop Scripting Forum.

    This would apply the foreground color as RGB to the Shape Layer Stroke.

    // 2016, use it at your own risk;

    #target photoshop

    if (app.documents.length > 0) {

    try {

    // =======================================================

    var idsetd = charIDToTypeID( "setd" );

        var desc2 = new ActionDescriptor();

        var idnull = charIDToTypeID( "null" );

            var ref1 = new ActionReference();

            var idcontentLayer = stringIDToTypeID( "contentLayer" );

            var idOrdn = charIDToTypeID( "Ordn" );

            var idTrgt = charIDToTypeID( "Trgt" );

            ref1.putEnumerated( idcontentLayer, idOrdn, idTrgt );

        desc2.putReference( idnull, ref1 );

        var idT = charIDToTypeID( "T   " );

            var desc3 = new ActionDescriptor();

            var idstrokeStyle = stringIDToTypeID( "strokeStyle" );

                var desc4 = new ActionDescriptor();

                var idstrokeStyleContent = stringIDToTypeID( "strokeStyleContent" );

                    var desc5 = new ActionDescriptor();

                    var idClr = charIDToTypeID( "Clr " );

                        var desc6 = new ActionDescriptor();

                        var idRd = charIDToTypeID( "Rd  " );

                        desc6.putDouble( idRd, app.foregroundColor.rgb.red );

                        var idGrn = charIDToTypeID( "Grn " );

                        desc6.putDouble( idGrn, app.foregroundColor.rgb.green );

                        var idBl = charIDToTypeID( "Bl  " );

                        desc6.putDouble( idBl, app.foregroundColor.rgb.blue );

                    var idRGBC = charIDToTypeID( "RGBC" );

                    desc5.putObject( idClr, idRGBC, desc6 );

                var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );

                desc4.putObject( idstrokeStyleContent, idsolidColorLayer, desc5 );

    /*            var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );

                desc4.putInteger( idstrokeStyleVersion, 2 );*/

                var idstrokeEnabled = stringIDToTypeID( "strokeEnabled" );

                desc4.putBoolean( idstrokeEnabled, true );

            var idstrokeStyle = stringIDToTypeID( "strokeStyle" );

            desc3.putObject( idstrokeStyle, idstrokeStyle, desc4 );

        var idshapeStyle = stringIDToTypeID( "shapeStyle" );

        desc2.putObject( idT, idshapeStyle, desc3 );

    executeAction( idsetd, desc2, DialogModes.NO );

    } catch (e) {};

    };

    Mortisfilm
    Known Participant
    February 8, 2017

    Still hoping for some experts to weigh in on this... Is it just not possible? Am I missing something super obvious?