Open ionitron-bot[bot] opened 6 years ago
How to change background color of toast ?
showToast(msg: string) { let toast = this.toastCtrl.create({ message: msg, duration: 3000, position: 'bottom', cssClass: 'changeToast' }); toast.present(toast); }
in app.css .changeToast{ .toast-wrapper { opacity: 0.6; border-radius: 5px !important; text-align: center; background: color($colors, primary); } };
Original issue by @bengrah-miller on 2018-03-02T14:31:49Z
Ionic version: (check one with "x") (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [x] 2.x [x] 3.x [ ] 4.x
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request
Current behavior: I want to change the background colour on a toast generated by ToastController. I've got a custom class residing in app.scss that I want to use for styling this toast. The toast is being called from a Service. In my service I have the following code:
In app.scss I have the class declared:
When I rebuild and deploy, the toast fires successfully and the background colour has changed, but the entire screen is now filled up with the toast background.
Expected behavior: The toast background colour changes, not the whole application
Steps to reproduce: See above
Other information: It's entirely possible I'm just not using cssClass right, but there's very little info on the Ionic Docs, Stack Overflow, etc.
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):