• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
5

Is there a way to swap fill and stroke color for shapes in Photoshop?

Explorer ,
Jan 23, 2024 Jan 23, 2024

Copy link to clipboard

Copied

In Ilustrator and InDesgin it's super easy: there is a button in the interface (swap fill and stroke) and a keyboard shortcut (Shift X), in Photoshop: nothing.

It would be great to be able to quickly swich the colors around because the most common 2 things I use for shapes are:

- a line (where i need a fill) 

- a rectangular frame (where i need a stroke)

so when i need to switch between a line and a frame i keep having to fiddle in the top mini-buttons interface: select the color from the recent swatches for a stroke, and selecting "none" for the fill >> that's 6 clicks!! It takes me out of my flow, is there a way to do this faster like in Illustrator/InDesign? And if not: how do I suggest this improvement to the developers?

Idea No status
TOPICS
iPadOS , macOS , Windows

Views

452

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
8 Comments
Explorer ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

Every time I use Photoshop I wish for this feature
Six clicks is crazy

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

quote

how do I suggest this improvement to the developers?


By @RV999

 

You have by marking this topic as an "idea" rather than as a bug or discussion.

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 10, 2024 Jun 10, 2024

Copy link to clipboard

Copied

It takes 2 clicks -- one for stroke, one for fill.

image.png

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Explorer ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

NO. it's 6

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

If you say so...

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 13, 2024 Jun 13, 2024

Copy link to clipboard

Copied

That sounds like it’s scriptable. 

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 13, 2024 Jun 13, 2024

Copy link to clipboard

Copied

Screenshot 2024-06-13 at 14.15.05.pngScreenshot 2024-06-13 at 14.15.13.png

// 2024, use at your own risk;
if (app.documents.length > 0) {
var myDocument = activeDocument;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var theFillColor = layerDesc.getList(stringIDToTypeID("adjustment")).getObjectValue(0).getObjectValue(stringIDToTypeID("color"));
var theStroke = layerDesc.getObjectValue(stringIDToTypeID("AGMStrokeStyleInfo"));
var theStrokeColor = theStroke.getObjectValue(stringIDToTypeID("strokeStyleContent")).getObjectValue(stringIDToTypeID("color"));
////////////////////////////////////
var desc4 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated ( stringIDToTypeID("contentLayer"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
desc4.putReference( charIDToTypeID( "null" ), ref1 );
var desc5 = new ActionDescriptor();
desc5.putObject( charIDToTypeID( "Clr " ), charIDToTypeID( "RGBC" ), theStrokeColor );
desc5.putObject( charIDToTypeID("Clr "), stringIDToTypeID("RGBColorClass"), theStrokeColor );
var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
desc4.putObject( charIDToTypeID("T   "), idsolidColorLayer, desc5 );
executeAction( charIDToTypeID("setd"), desc4, DialogModes.NO );
////////////////////////////////////
var desc8 = new ActionDescriptor();
var ref4 = new ActionReference();
ref4.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc8.putReference( stringIDToTypeID( "null" ), ref4 );
var desc9 = new ActionDescriptor();
    var desc10 = new ActionDescriptor();
        var desc11 = new ActionDescriptor();
        desc11.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), theFillColor );
    desc10.putObject( stringIDToTypeID( "strokeStyleContent" ), stringIDToTypeID( "solidColorLayer" ), desc11 );
    var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );
    desc10.putInteger( idstrokeStyleVersion, 2 );
    desc10.putBoolean( stringIDToTypeID( "strokeEnabled" ), true );
desc9.putObject( stringIDToTypeID( "strokeStyle" ), stringIDToTypeID( "strokeStyle" ), desc10 );
desc8.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "shapeStyle" ), desc9 );
executeAction( stringIDToTypeID( "set" ), desc8, DialogModes.NO );
};

Votes

Translate

Translate

Report

Report
Community Expert ,
Jun 15, 2024 Jun 15, 2024

Copy link to clipboard

Copied

LATEST

Updated to handle »No Color«. 

Screenshot 2024-06-15 at 14.24.45.pngScreenshot 2024-06-15 at 14.24.55.png

 

// switch shape layer’s fill and stroke colors; 
// 2024, use at your own risk;
if (app.documents.length > 0) {
var myDocument = activeDocument;
try {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var theFillColor = layerDesc.getList(stringIDToTypeID("adjustment")).getObjectValue(0).getObjectValue(stringIDToTypeID("color"));
var theStroke = layerDesc.getObjectValue(stringIDToTypeID("AGMStrokeStyleInfo"));
var fillEnabled = theStroke.getBoolean(stringIDToTypeID("fillEnabled"));
var strokeEnabled = theStroke.getBoolean(stringIDToTypeID("strokeEnabled"));
var theStrokeColor = theStroke.getObjectValue(stringIDToTypeID("strokeStyleContent")).getObjectValue(stringIDToTypeID("color"));
////////////////////////////////////
if (strokeEnabled == true) {
var desc19 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc19.putReference( stringIDToTypeID( "null" ), ref3 );
var desc20 = new ActionDescriptor();
var idfillContents = stringIDToTypeID( "fillContents" );
var desc21 = new ActionDescriptor();
desc21.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), theStrokeColor/*desc22*/ );
var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
desc20.putObject( idfillContents, idsolidColorLayer, desc21 );
var idstrokeStyle = stringIDToTypeID( "strokeStyle" );
var desc23 = new ActionDescriptor();
desc23.putInteger( stringIDToTypeID( "strokeStyleVersion" ), theStroke.getInteger(stringIDToTypeID( "strokeStyleVersion" )) );
desc23.putBoolean( stringIDToTypeID( "fillEnabled" ), true );
desc20.putObject( idstrokeStyle, idstrokeStyle, desc23 );
desc19.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "shapeStyle" ), desc20 );
executeAction( stringIDToTypeID( "set" ), desc19, DialogModes.NO );
} else {
var desc12 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc12.putReference( stringIDToTypeID( "null" ), ref3 );
var desc13 = new ActionDescriptor();
var desc14 = new ActionDescriptor();
desc14.putInteger( stringIDToTypeID( "strokeStyleVersion" ), 2 );
desc14.putBoolean( stringIDToTypeID( "fillEnabled" ), false );
desc13.putObject( stringIDToTypeID( "strokeStyle" ), stringIDToTypeID( "strokeStyle" ), desc14 );
desc12.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "shapeStyle" ), desc13 );
executeAction( stringIDToTypeID( "set" ), desc12, DialogModes.NO );
};
////////////////////////////////////
if (fillEnabled == true) {
var desc8 = new ActionDescriptor();
var ref4 = new ActionReference();
ref4.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc8.putReference( stringIDToTypeID( "null" ), ref4 );
var desc9 = new ActionDescriptor();
    var desc10 = new ActionDescriptor();
        var desc11 = new ActionDescriptor();
        desc11.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), theFillColor );
    desc10.putObject( stringIDToTypeID( "strokeStyleContent" ), stringIDToTypeID( "solidColorLayer" ), desc11 );
    var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );
    desc10.putInteger( idstrokeStyleVersion, 2 );
    desc10.putBoolean( stringIDToTypeID( "strokeEnabled" ), true );
desc9.putObject( stringIDToTypeID( "strokeStyle" ), stringIDToTypeID( "strokeStyle" ), desc10 );
desc8.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "shapeStyle" ), desc9 );
executeAction( stringIDToTypeID( "set" ), desc8, DialogModes.NO );
} else {
// =======================================================
    var desc10 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
    desc10.putReference( stringIDToTypeID( "null" ), ref1 );
        var desc11 = new ActionDescriptor();
        var idstrokeStyle = stringIDToTypeID( "strokeStyle" );
            var desc12 = new ActionDescriptor();
            desc12.putInteger( stringIDToTypeID( "strokeStyleVersion" ), 2 );
            desc12.putBoolean( stringIDToTypeID( "strokeEnabled" ), false );
        desc11.putObject( idstrokeStyle, idstrokeStyle, desc12 );
    var idshapeStyle = stringIDToTypeID( "shapeStyle" );
    desc10.putObject( stringIDToTypeID( "to" ), idshapeStyle, desc11 );
executeAction( stringIDToTypeID( "set" ), desc10, DialogModes.NO );
};
} catch (e) {alert ("no")}
};

 

Votes

Translate

Translate

Report

Report