Search code examples
ionic-frameworkionic-view

Change Color of Notification Bar According to Nav Bar Color in ionic 1 Application


I'm developing Android application using Ionic 1 Framework.

On using the app on mobile the color of notification bar is not changing it remains default.

Is there any specific setting or plugin that we need to use, to change color of notification bar in accordance with Nav bar color ?


Solution

  • With the plugin "cordova-plugin-statusbar", (https://github.com/apache/cordova-plugin-statusbar) I've done it like this :

    if (window.StatusBar) {
        if (ionic.Platform.isAndroid()) {
            StatusBar.backgroundColorByHexString('#0288D1');
        } else {
            StatusBar.styleLightContent();
        }
    }
    

    but if you want to link it with your nav-bar, you should use ionic color variables, like "assertive", as in this link : http://ionicframework.com/docs/components/#colors
    You can read the docs at the two URLs I gave you for more informations.