iOS: How to display a banner notification with a dark theme

299 Views Asked by At

I want to display a banner notification with a dark background and light text. iOS naturally does this if the phone is using dark mode. However, in light mode, when I use WhatsApp, I noticed banners have a dark theme as long as they are displayed while the application is in the foreground.

How can I create something similar? I've been looking into using UNNotificationContentExtension. This seems to work for custom actions displayed via a long click. For example, when I set view.backgroundColor, this does not set the background color for the whole banner. It only does it for custom actions.

1

There are 1 best solutions below

0
On

This isn't possible, since the system manages the creation of these alerts. This is probably restricted for consistent UI.