Search code examples
angularionic-frameworkionic4

How to set background color IONIC 4


I having problems trying to change the background color in just one IONIC 4 (--type=angular) page. I am trying to add a class for the ion-content. In my html file I Have:

<ion-content class="fondologin">
...
</ion-content>

In my sass I have:

.fondologin{
    background-color: #111D12!important;
}

The background color is never changed. If I add --ion-background-color:#111D12; in variables.scss the background is successfully changed for every page but I just one to change the color in one page. How can I achieve this?


Solution

  • For some reason I solved it this way:

    First of all I added --ion-background-color:#ffffff; in the variables.scss file inside theme folder.

    In my Page scss I wrote:

    ion-content{
    
        --ion-background-color:#111D12;
    }
    

    After that the background was successful set.