Change NavBar color for all the pages in ionic

二次信任 提交于 2019-12-05 08:12:35

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;
der.marty

If anyone is looking for a solution using dynamic themes, it is possible to change the text color using css like this in Ionic 3:

.header .toolbar-title {
    color: #fff !important;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!