I’ve put together an AppleScript that will toggle the background color of selected messages to red or none:
tell application "Mail" set selectedMessages to selection repeat with thisMessage in selectedMessages if background color of thisMessage is red then set background color of thisMessage to none else set background color of thisMessage to red end if end repeat end tell
I am very happy with it, with one exception: is there a way to set the foreground color of selected messages? I am using dark mode and I’d rather view Mail messages with foreground colors (as opposed to background colors).
I’ve tried searching through the Apple Mail AppleScript dictionary, but I am at a loss. I know you can set foreground colors using Mail rules, but I am at a loss on how to do this in my AppleScript.
An example of the Mail Rule that I want to duplicate in my script: