When I was using Ionic 3, if I changed the color of ion-toolbar like this: ion-toolbar color="customcolor", the text color of title would change to stay visible. Example: if the color of toolbar was dark, the color of text would be light.
This is gone in Ionic 4. I can’t make it work.
Anyone has any ideia what is wrong?
In fact, no. If I use a pre-existing color from variables.css (primary, secondary, warning), it works very well (the color is changed and the text color changes accordingly).
<ion-toolbar color="primary">
If I use a color created in the same variables.css like this:
I think you confused the color attribute in <ion-toolbar color="primary"> with the color property in CSS.
When you see the ‘Properties’ of color in Ionic UI documentation, it is referring to usages like <ion-toolbar color="primary"> and it only takes in specific string values as specified in the documentation (primary, secondary, danger etc.)
The CSS custom properties in the documentation --color is meant to be used when for example you assign a class to the element like:
Hi, I also have troubles with custom colors in toolbar, but I think there is an issue.
To be sure, try it first on chrome for example with ionic serve, you should see your custom color is applied. If it is, then check your Android version your testing on :
Ionic documentation HERE says custom colors can be used the same way as the default ones. Also, I already tried to use the custom color in a CSS class like you described and the same problem occurs. Anyway, thanks for trying to help me
Hi, when using ionic serve on browser I also have the same issue: the custom color is applied but the color of ion-title does not change.
My device has 8.1 version of Android (Oreo).
Thanks.
If you use a pre-existent color (success, warning, danger, primary) the text color will change.
I tested putting my ‘animal’ color values on ‘success’ color variables and it works correctly. The problem is the custom color. In Ionic 3 works perfectly.
Sorry I forgot to update the value of my own color to ‘animal’.
See updated version and my other post for setting the color in the variables.scss (only!)