Apple Mail – Set Background Color of Selected Messages in the Message List

How would I go about having a keyboard shortcut which would set the color of an email in I'm talking about the color of the email in the list not the color of the text, . Ordinarily this is done by clicking on an email and then the colors panel and selecting a color and closing the panel.

Use the Select a Menu Item action to select the Message ➀ Flag ➀ Red (or whatever) menu:


I'm not sure that's the same thing. I think OP is referring to "colour-coding" (although a quick try at following those instructions did nothing on my machine).

Hey @ihf,

Use an Execute an AppleScript action to run this AppleScript, after selecting the messages you want to alter.


# Auth: Christopher Stone <>
# dCre: 2023/05/19 08:17
# dMod: 2023/05/19 19:33
# Appl: Mail
# Task: Set Background Color of Selected Messages in Message List.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Set, @Background, @Color, @Selected, @Messages

tell application "Mail"
   set selectedMessageList to selection
   if selectedMessageList β‰  {} then
      repeat with theMessage in selectedMessageList
         tell theMessage
            set its background color to red
            set its read status to not (get its read status) -- Force color to show.
            set its read status to not (get its read status) -- Restore previous read status.
         end tell
      end repeat
      error "Zero messages were selected!"
   end if
end tell




other	-- I'm not aware of a means to use β€˜other’


1 Like

@ccstone Thank you! That looked very promising but I opened it in Script Editor to test and select an email in the and ran it but nothing changed.

I think an extra line has snuck in there -- delete the

            return its background color

...line and try again.

Note that the background colour is masked when the mails are selected, so it isn't immediately obvious that the colour has been set.

Perfect! Thanks very much!

Quite right – thanks for catching that! :sunglasses:

I was looking to see if I could discover the format for the β€˜other’ color and neglected to remove the offending line.

I've fixed the posted script...

1 Like