I want to know that how we can change the background color for the toast notification in Windows Metro (or Desktop) app.
Thanks in advance.
If you need to change the background of the Toast then you need to use getView(). setBackground() function. If You need to change the color of the view created then you need to use getView(). getBackground().
The easiest solution to adjust the BG of Toastify, or in fact any styles would be to use the ToastContainer props toastStyle: which takes in JSX attributes. After importing the necessary packages , while adding the ToastContainer component , just pass in the toastStyle prop and you shall be good to go.
In our sample, I have used the ToastGeneric template, as this defines the Toast Notification as Adaptive. The below code helps in doing it. text elements are used to display the text in the toast, if the user needs to add image in the toast then he can display it by adding the image element.
Foreground: You can set "Foreground text" in you app manifest to dark or light.
Background: This follows the "Background color" of the app manifest - and hence will be the same as the app's tile background.
For most of the apps I've worked on, it's enough to set the tile color according the UI spec - and then set the 'foreground text' to light or dark. You can surely override the light/dark themes if you want to too.
For desktop apps, the background color used on toast notifications (and Start screen tiles) is not configurable by the app itself. The color for the tiles is determined by the Start screen color theme chosen by the user (PC Settings -> Personalize -> Start screen), and the color of the background of toast notifications is always gray (when not in a high-contrast theme).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With