I'm looking for a way to quickly get the inverse of a color into the foreground or background color swatch. Ideally, I would like to use the eyedropper to sample a color from an image, but have the sample be the inverted color. For instance, were I to use the eyedropper to sample #0ff000 from an image, I would like #f00fff to be the color that gets stored in the swatch.

Can this be done? If not, is there some approximation that would get me the same result quickly?

2 Answers 2


This can be done with a very simple script:

var color = app.foregroundColor;
color.hsb.hue = color.hsb.hue < 180 ? color.hsb.hue + 180 : color.hsb.hue - 180;
app.foregroundColor = color;

save this as a your_name.jsx file to

  • Windows: C:\Program Files\Adobe\Adobe Photoshop CC 2019\Presets\Scripts
  • Mac: /Applications/Adobe Photoshop CC 2019/Presets/Scripts

folder and after restarting Photoshop the script will be available in File > Scripts > your_name. Then you can assign it to a shortcut (via menu Edit > Keyboard Shortcuts...) or use it in an Action (and assign it to an F-key). This way after calling the script your foreground color will be changed to an inverted color (in RGB model).

You can easily modify it so that it'd change background color or, for instance, set a BG color using a FG color... just change app.foregroundColor with app.backgroundColor.

And the same way you can change color saturation or brightness (or any of the rgb, cmyk and lab values).

  • 2
    +1 My answer bows before your answer...
    – Wolff
    Commented Sep 11, 2019 at 23:06
  • @Wolff - Do you think I should switch the correct answer to this one? I still like yours and think it brings value because not everyone is going to want to mess around with JavaScript.
    – bubbleking
    Commented Sep 20, 2019 at 16:08
  • @bubbleking, it's all up to you, I won't mind. Do it if you think this answer is more helpful. Btw: I just realize that this answer doesn't invert the color, but only changes the hue. Could easily be fixed if you need the inverted color instead.
    – Wolff
    Commented Sep 20, 2019 at 20:36

As a hacky solution, you could do this:

  1. Pick your color using the Eyedropper Tool.
  2. Fill the image with the color using Alt + Backspace.
  3. Invert the color using Ctrl / Cmd + I.
  4. Pick the inverted color using the Eyedropper Tool.
  5. Undo two times by pressing Ctrl / Cmd + Z two times.

That's two clicks and four keyboard shortcuts. Don't think I could do it any simpler.

  • There's a caveat to that; you have to have a pixel layer selected in the layers panel... or, at least, it can't be a text layer or (maybe) some other types of non-pixel layers.
    – bubbleking
    Commented Sep 11, 2019 at 16:59
  • 1
    @bubbleking, true! But you could use this idea to make an action which will work in all cases if you add a new layer which you remove again afterwards.
    – Wolff
    Commented Sep 11, 2019 at 17:20
  • Well, it took a bit of finagling to get the eyedropper working properly (see designeasy.co/2018/08/how-to-sample-color-from-image-in.html), and I'd never made an action before, but I made it work, so problem solved!
    – bubbleking
    Commented Sep 11, 2019 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.