There are two ways to do this, based on whether you want to change color on only one page or want to change it on all pages of your application:
1) Change it on one page / view
As you can see here
To change the theme, simply configure the $colors map in your src/theme/variables.scss file:
$colors: ( // ... newcolor:
And then use it in the view
<ion-header> <ion-navbar color="newcolor"> <ion-title> HELLO </ion-title> </ion-navbar> </ion-header>
2) Change it on all pages / views
In this case, you need to add the following to the variables.scss file to override the default values โโof Ionic:
$toolbar-ios-background:
Edit
Hi, how to add gradient in app / theme / app.variables.scss?
You can add the colors that you are going to use in src/theme/variables.scss :
$header-first-color:
And then set the rule to use it (in your app.scss file if you want to apply it on every page or in page-name.scss if you want to apply it to one page):
ion-header { .toolbar-background { background: linear-gradient(135deg, $header-first-color 0%, $header-last-color 100%); } }
source share