Add Smarter Found Image Option to Work With Both Light Mode & Dark Mode

Found Image feature is great in retrieve the position of targeted image.

But ever since Apple rolled out the Dark Mode feature for macOS. A new problem arise along with it, that is every time one build a macro in Keyboard Maestro that involves Found Image option, one kinda have to build TWO Found Image based actions, one Found Image is for image recognition for Light Mode GUI then another Found Image for Dark Mode.

This works but it makes building every macro that involves Found Image based Action a doubled workload and tedious.

It might be a wild thought, but could it be possible to investigate Apple's Dark Mode color rendering principle in terms of color, contrast etc, then roll out a enhanced version of Found Image feature which allos users to build only one Found Image based Action that works in both Light Mode & Dark Mode automatically!

Thanks in advance.

In theory, sure it is possible (my programming geek friends have long had a saying “It’s just code” - ie, pretty much anything can be done).

But the UI for this is hard to imagine, especially smeared across all the places find image UI now shows up.

For the gain of handling this dark/light switch, I'm not sure it will even be worth the complexity added to the normal case.

Just ran into this scenario, I handled it with duplicate code paths and multiple image matches and was thinking a couple of ways to handle this:

  1. An if statement condition for detecting dark mode. I'd still have most of my code duplicated but currently I assume if one image isn't found it's dark mode and to search for the other image. It would be a bit cleaner to know for sure up front which I should be detecting. (a token in the System category returning the current mode would also solve this and be handy)

  2. allow found image options to have 2 image options and use the matching options unique, topmost, etc... to apply if both images are found. (or have one image marked for use in dark mode only?)

  3. for an "Any Condition is true" if search a way to save the condition that triggered the match then do operations on that image (similar to the Tripped Trigger tokens).

1 seems the simplest since I don't think has any real UI changes.

2 has UI changes adding a 2nd image box and having selector "Dark Mode Image", not sure on edge cases that might blow this up?

3 seems the most complicated I think I saw other messages that this type of dynamic image handling was unlikely to happen.

Well this already exists in the form of the DARKMODE() function. See the KM wiki here: and an example of how to use it taken from the KM forum here:

Hope that helps a bit.


shoot don't know how I missed that. That does help for that part. Thanks.


OK, I found some more cool stuff. I asked for a way to save the image that was found in a conditional and while you can't save the image itself that was found you can save the coordinates of where it was found. Perfect for this use case. It doesn't show up in the Insert Token list but there is a token FoundImage that has the coordinates of the found image.

So you can build a conditional with 2 different images and which ever one is found get the coordinates and do stuff with it. Here's an example to click the Do Not Disturb in Notification Center in either Light Mode or Dark Mode.

If you search for "dark" in the Keyboard Maestro Help menu, it shows up there. This is a quick way to find some options.

Searching for "found" also reveals the FoundImage token, which is in the Insert Token list (?).

Years ago when Apple introduced that search in the help menu, it didn't seem to work very well for me and now I rarely use it. I'll have to start using it again. Normally I type the word in the search for adding actions, but typing Dark there brings it up too. I must've just spaced (I think I looked for it as a condition in an if statement and when it wasn't there stopped looking).

When I type in FoundImage in the Help search bar it does show up in Help with lots of options, one of the options is All > %FoundImage%, highlighting it brings up Edit > Insert Token > All. However there is no FoundImage on that list. It also isn't on the list when I have a Set Variable action up and click the Insert Token on that action.

OK, I figured this out I was looking for "FoundImage" as the token. It's in the menu as "The Last Found Image". I wasn't looking that far down the list. It's under Edit > Insert Token > Macro Information too (which I should've thought of checking).

It is, its just under its name.

If you hold the shift key down, it'll show you the raw token values, and if you hold the Option key down it will take you to the wiki Help.


hey this rules. totally saved one of my more complicated macros. works perfectly. Thanks!!