Well, I tell you… I’m stumped. I’ve tried everything I can think of to help you, but to no avail.
This may just be one of those things you cannot do… Because Ionic uses the shadow-dom stuff, you cannot just “reach in” to those items in the shadow-dom and style them. I think the only way to solve this problem is for the Ionic folks to expose a variable in their API, like --button-background-color or some such, so that you can change that value.
Thanks for your reply but I want to change the text color (for the CLOSE BUTTON) not the background color and the documentation says "use --button-color", this is the link to the toast css custom properties but where, how??
Properties like --button-color should solve problems related to shadow dom…
Here we have two problems
the close button seems not customizable
adding buttons and declaring the cssClass to them (see the example below) doesn’t work
Inspecting the DOM the <button> (inside the ion-toast element) contains the declared class but the css code isn’t found (I’ve placed it in variables.scss, global.scss and the component page .scss)
<ion-header>
<ion-toolbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item>
<ion-label>I am item 1</ion-label>
</ion-item>
<ion-item [ngClass]="{ 'use-pink-background': item2BackgroundSet }">
<ion-label>I am item 2. Value of backgroundSet: {{item2BackgroundSet}}</ion-label>
</ion-item>
</ion-list>
<ion-button (click)="handleClick()">
I am a button. Push me to toggle the background color of item 2 and pop up a toast.
</ion-button>
</ion-content>
Thanks for your time, i’m drive crazy, I’ve created a new blank project and copied your code but the toast button is always blue, the cssClass value is totally ignored
You must have some css somewhere that sets it to blue, because by default it would be white. When I comment out the --button-color css in global.scss then my button text color is white.