In that case, the Toast.setTheme() function is for you! In supported browsers and operating systems, toasts will automatically choose a theme based on the user's OS settings. Usage. It is a lightweight and easily customizable component. specified element and call the toast() method. To close it, use a