Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the background color of ion-header in ionic 2? [duplicate]

How to change the header color? I tried below but didn't succeeded

 <ion-header>
  <ion-navbar danger>
    <ion-title>TITLE</ion-title>
  </ion-navbar>
</ion-header>

My variable.scss is:

$colors: (
  primary:    #387ef5,
  secondary:  #32db64,
  danger:     #f53d3d,
  light:      #f4f4f4,
  dark:       #222
);
like image 931
Pawan Avatar asked Mar 07 '17 06:03

Pawan


People also ask

How do you change the color of an ion title?

You can change the background color of the toolbar with the standard title by setting the --background CSS variable on ion-toolbar . This will give the effect of the header changing color as you collapse the large title.

How do I change the color of my ion-toolbar?

Styling the Ionic 5 Toolbar ( ion-toolbar ) $toolbar-background: #123456; $toolbar-border-color: #123456; $toolbar-text-color: #123456; $toolbar-active-color: #123456; $toolbar-inactive-color: #123456; Just put them in the variables. scss file and change their values to your desired colors.

How do I put a background on my header?

You can set or change the background color and image of the page header with Zakra. Follow the steps as mentioned below: From your WordPress Dashboard, go to the Appearance > Customize > Content >Page Header section. Under the Background options, choose the Background Color or Background Image for the page header.


2 Answers

You can change it globally if you want to in your variables.scss under/in the theme folder:

$toolbar-background: blue;

For all the reference Ionic SASS Variables to override follow this link

like image 59
Yasir Avatar answered Sep 21 '22 04:09

Yasir


 <ion-header>
  <ion-navbar color="color3">
    <ion-title></ion-title>
  </ion-navbar> 
</ion-header>

you can set your custom color in src/theme/variable.scss like this :

$colors: (
  primary:    #8B4789,
  secondary:  #32db64,
  danger:     #f53d3d,
  light:      #f4f4f4,
  dark:       #222,
  color1: #15c178,
  color2: #8B4789,
  color3 : #07904d,
  color4: #673665,
  brown: #B75E33,
  ycBlue: #638AF1
);

I hope this will work for you

like image 26
Devansh sadhotra Avatar answered Sep 21 '22 04:09

Devansh sadhotra