How to set background color IONIC 4

Solution 1:

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.

Solution 2:

I am going to repost the top commented answer , with an extra explanation

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

Starting from ionic 4, Ionic component implements the concept of shadowDOM, and the old method of finding css selectors in the component that implements shadowDOM no longer works

As such, any modification can only be made if you change the variable that the component references

for example, if ion content references

--ion-background-color: #ffffff

The only way you can modify the background color is by doing this in your css file

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