NSAlert button background/contrast

If I use NSAlert the buttons look like this:

The Cancel button has a gray background. We got complaints about the bad contrast and people pointed out that the alerts from System Settings look like this:

Here the Cancel button has a white background. Unfortunately I did not find out how to make the buttons in my own alerts look like those in System Settings. Setting the button's bezel color to white did not work. Any help would be highly appreciated. Thanks.

Best regards, Marc

Answered by DTS Engineer in 823731022

Hello,

You'll want try different values for NSAlert.Style to change the appearance of the alert e.g. NSAlert.Style.critical.

Hello,

You'll want try different values for NSAlert.Style to change the appearance of the alert e.g. NSAlert.Style.critical.

@DTS Engineer

I already tried this, but it only changes the icon of the alert, but the way the buttons are displayed is identical.

Style is the only API available for changing the appearance of the alert and its buttons.

Adding additional buttons with addButton(withTitle:) won't achieve what you want either so we recommend filing an enhancement request with the Feedback Assistant.

It would also be helpful to have a bug report w.r.t. "We got complaints about the bad contrast".

Ok. But why do have some buttons a gray background and some a white one? Is this behavior is documented somewhere? That's the question I got from our accessibility folks…

NSAlert button background/contrast
 
 
Q