Change NavBar color for all the pages in ionic












5















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">










share|improve this question



























    5















    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">










    share|improve this question

























      5












      5








      5








      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">










      share|improve this question














      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">







      ionic-framework ionic3 navbar






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 12 '18 at 8:55









      RiddhiRiddhi

      805932




      805932
























          3 Answers
          3






          active

          oldest

          votes


















          6














          Add following line to variables.scss file to change the color globally.



          $toolbar-background: #3D9BDD;





          share|improve this answer
























          • Thank you. It worked.

            – Riddhi
            Mar 12 '18 at 9:32











          • how can we change the navbar text color?

            – Junaid
            Sep 8 '18 at 18:14











          • Where in the docs of Ionic did you find that property?

            – user3748883
            Dec 10 '18 at 9:25



















          0














          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;





          share|improve this answer































            0














            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;
            }





            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49231296%2fchange-navbar-color-for-all-the-pages-in-ionic%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              6














              Add following line to variables.scss file to change the color globally.



              $toolbar-background: #3D9BDD;





              share|improve this answer
























              • Thank you. It worked.

                – Riddhi
                Mar 12 '18 at 9:32











              • how can we change the navbar text color?

                – Junaid
                Sep 8 '18 at 18:14











              • Where in the docs of Ionic did you find that property?

                – user3748883
                Dec 10 '18 at 9:25
















              6














              Add following line to variables.scss file to change the color globally.



              $toolbar-background: #3D9BDD;





              share|improve this answer
























              • Thank you. It worked.

                – Riddhi
                Mar 12 '18 at 9:32











              • how can we change the navbar text color?

                – Junaid
                Sep 8 '18 at 18:14











              • Where in the docs of Ionic did you find that property?

                – user3748883
                Dec 10 '18 at 9:25














              6












              6








              6







              Add following line to variables.scss file to change the color globally.



              $toolbar-background: #3D9BDD;





              share|improve this answer













              Add following line to variables.scss file to change the color globally.



              $toolbar-background: #3D9BDD;






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 12 '18 at 9:24









              Ajantha BandaraAjantha Bandara

              641718




              641718













              • Thank you. It worked.

                – Riddhi
                Mar 12 '18 at 9:32











              • how can we change the navbar text color?

                – Junaid
                Sep 8 '18 at 18:14











              • Where in the docs of Ionic did you find that property?

                – user3748883
                Dec 10 '18 at 9:25



















              • Thank you. It worked.

                – Riddhi
                Mar 12 '18 at 9:32











              • how can we change the navbar text color?

                – Junaid
                Sep 8 '18 at 18:14











              • Where in the docs of Ionic did you find that property?

                – user3748883
                Dec 10 '18 at 9:25

















              Thank you. It worked.

              – Riddhi
              Mar 12 '18 at 9:32





              Thank you. It worked.

              – Riddhi
              Mar 12 '18 at 9:32













              how can we change the navbar text color?

              – Junaid
              Sep 8 '18 at 18:14





              how can we change the navbar text color?

              – Junaid
              Sep 8 '18 at 18:14













              Where in the docs of Ionic did you find that property?

              – user3748883
              Dec 10 '18 at 9:25





              Where in the docs of Ionic did you find that property?

              – user3748883
              Dec 10 '18 at 9:25













              0














              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;





              share|improve this answer




























                0














                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;





                share|improve this answer


























                  0












                  0








                  0







                  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;





                  share|improve this answer













                  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;






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 12 '18 at 10:11









                  UtpaulUtpaul

                  1,0341417




                  1,0341417























                      0














                      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;
                      }





                      share|improve this answer






























                        0














                        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;
                        }





                        share|improve this answer




























                          0












                          0








                          0







                          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;
                          }





                          share|improve this answer















                          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;
                          }






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 25 '18 at 18:21









                          Stephen Rauch

                          28.7k153557




                          28.7k153557










                          answered Nov 25 '18 at 18:02









                          der.martyder.marty

                          11




                          11






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49231296%2fchange-navbar-color-for-all-the-pages-in-ionic%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                              Calculate evaluation metrics using cross_val_predict sklearn

                              Insert data from modal to MySQL (multiple modal on website)