Search code examples
angularionic-frameworkionic4

Adding a button text color


I am using Ionic 4 and I have a button with outline and transparent background. I want to change the color of its text.

According to other answers such as this, the color property is dictate by --ion-color-contrast which, however, does not work. According to another answer, I should be able to use --color to set it, which also does not work.

The Ionic 4 documentation says that --color should change it but it does not work. Please see link to fiddle.


Solution

  • The color is being inheriting from --ion-color-base, try removing that by deleting the color="primary" from the HTML, because the .ion-color-primary class is using !important and that property make everything in color.

    By removing that attribute, your code will work.