Search code examples
cocoacolorsmacos-big-surtint

Set global tint in Cocoa applications


I noticed that many apps uses a custom global tint color like Pages (Yellow) or Music (Red). NSAlert default buttons respect this tint, as NSOpenPanel and others do (for example drop-down arrow as show in picture).

I alos noticed that NSAlert brings a delete button that shows text in red. Do you know how to get it to appear?

Thanks

How could I specify a specific global color. I create UI using code and not Storyboard.

Pages Yellow tint example

Music Red tint example


Solution

  • Searching in Apple's app folders, such as Pages, I found what we need to do to change the app's overall tint.

    1. Create a color object in the Asset;
    2. In the info.plist add the key NSAccentColorName that is a string assigned to the color name created at step 1;

    This colors NSAlert default buttons and all control's accent elements.