Macro to automatically change to dark mode in Photos

I like Light Mode on my Mac, but prefer Dark Mode when I use Apple Photos. I would like a macro that automatically changes to dark mode when Photos is frontmost and back to light mode when it is not. I tried to do this myself, but couldn't. Does anyone have on which will do that?

This seems to work, albeit with very limited testing :).

Download Macro(s): Photos dark mode toggler.kmmacros (4.5 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 15.5
  • Keyboard Maestro v11.0.4

It works by setting two triggers on one macro, to handle both activating and deactivating Photos. The Case statement then branches based on the value in %Trigger%, setting a boolean to true or false. The final action is the AppleScript that toggles the mode; it gets the boolean value from the passed-in variable.

-rob.

Thanks for this. I installed it and it went into dark mode, but when I switched away from Photos the system remained in dark mode. I had to go to settings to get back to light mode. Is there a way to make it switch back to light mode without going into settings?

@TinRobot @griffman

I think the problem is just that both trigger strings end in "activates"

( you probably need to invert the boolean and test on "deactivates" )

I check for " activates," but maybe Keyboard Maestro ignores that space -- but it worked for me in testing. Anyway, you're right—testing on "not containing deactivate" is better; try this version.

Download Macro(s): Photos dark mode toggler.kmmacros (4.5 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 15.5
  • Keyboard Maestro v11.0.4

-rob.

FWIW, a variant toggling on the value of an expression (rather than in a statement)

Dark mode on for Photos.app focus- off on exit.kmmacros (3.2 KB)


OR, if you prefer to express it in AppleScript (rather than JS for Automation):

Dark mode on for Photos.app focus- Light mode on exit (AppleScript expression).kmmacros (3.4 KB)

1 Like

Thank you again, especially for the super quick response! Unfortunately, this one is behaving no differently for me. It changes to dark mode in Photos, but when I exit Photos it still remains in dark, but oddly, Finder is light and Firefox and some other apps, but Safari remains dark and Messenger as well as Photos, so that's odd. I notice that manually switching between light and dark behaves the same way, so maybe there is some weird thing going on with my Mac.

What version of macOS are you using?

-rob.

15.5 and I have KM 11.0.4

That is very confusing then, as it works perfectly here. There are some sites there that say you have to relaunch affected apps for the change to take effect, but the AppleScript solution is supposed to be better about that.

For some reason, it seems your Mac is more reluctant to make the change in real time. As a test, what happens if you try @ComplexPoint's version, posted above? Remember to disable my version first.

-rob.

Okay, so I found out an issue which was my fault. I forgot had another macro attempt running in another folder which I imagine was causing confusion. Anyway, I disabled it and then tried again with your macro and now nothing happens at all. So I am baffled.

Can you confirm that the macro group is enabled, and that the macro is enabled?

-rob.

Oh boy. The macro was enabled, but the group got disabled. I did not disable it myself, so not sure how, but now I enabled the group and.... It works!!! Thank you so much and sorry for the confusion at my end.

Can I move that macro out of the test folder it is in and into my Photos folder, or should it stay in the test folder?

You can move it wherever you like, but make sure the macro group you put it in is one that's available in all applications—you want the activation trigger to work regardless of which app is frontmost.

-rob.

1 Like

Good point. I forgot about the folder having to be global. I don't make new macros every day, so some basics slip my mind.

Thanks again for your help with this. I love that Photos can be in dark mode now without impacting the system otherwise.

2 Likes