I am new in ionic and wants to learn it. my question is How to change nav bar color for all the pages in ionic 3.
I have been using following code
<ion-header>
<ion-navbar color="primary">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Hello Ionic</ion-title>
</ion-navbar>
</ion-header>
Is there any way to change nav bar color for all the pages instead of manually doing <ion-navbar color="primary">
The text color of the navigation bar can be changed using two inbuilt classes: navbar-light: This class will set the color of the text to dark. This is used when using a light background color. navbar-dark: This class will set the color of the text to light. This is used when using a dark background color.
Here is an example of an Ionic 5 menu: To style the Ionic 5 toolbar or top bar you have a bunch of scss variables which are: Just put them in the variables.scss file and change their values to your desired colors. ion-header, ion-content, ion-footer and ion-toolbar make part of every Ionic 5 page so you can either:
To style the Ionic 5 toolbar or top bar you have a bunch of scss variables which are: Just put them in the variables.scss file and change their values to your desired colors. ion-header, ion-content, ion-footer and ion-toolbar make part of every Ionic 5 page so you can either:
The names of the classes are kept in a manner to override the inbuilt navigation bar classes. The background color is set by directly specifying the background-color property with the color needed. The navbar text and the brand text color can be set using the .navbar-text and .navbar-brand classes.
Add following line to variables.scss file to change the color globally.
$toolbar-background: #3D9BDD;
This can achieve different way i will show you 2 way
First way
In variables.scss file $colors portion add customColor
$colors: (
primary: #488aff,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222,
customColor:(
base: #00953B,
contrast: #ffffff
)
);
Here base is background color and contrast is text-color
And change in .html file
<ion-header>
<ion-navbar color="customColor">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Hello Ionic</ion-title>
</ion-navbar>
</ion-header>
Second way
override default color toolbar color
$toolbar-background: #00953B;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With