There might be an AppleScript to do this - my quick search didn't find one but hopefully someone here can solve that as it would be very useful.
In the meantime I've been using an image match (as you have already tried). There are ways to make the matching of the image to click on more reliable - but even assuming it works it is annoying that your current mouse cursor has to jump up to the top of the screen to achieve this. To solve that bit you can set the gear menu in the mouse mouse Action to restore the mouse to where is was - just in case you had missed that.
And one other thing that you might or might not realise is that after clicking on the Highlight Icon you can set each color with a single letter followed by the Return key. So, B for blue or Y for yellow.
Sometimes the reason these Macros which rely on a Found Image can fail if the Icon changes (i.e. sometime darker when selected). A way to deal with that can be found here (the discussion was about Light and Dark Mode but it works with any changing image.)