I am following the ionic 2 documentation for setting the iOS status bar color but it is not working. The status bar text is white which means on my white background it is invisible.
The code I have put in my app constructor is:
StatusBar.overlaysWebView(true);
StatusBar.styleDefault();
I have imported StatusBar using:
import {StatusBar} from 'ionic-native';
I have also checked that the cordova statusbar plugin is installed.
You can try like this add this in the config.xml, with the hex value of the color you want to set:
For ngCordova or ionic-native you can use
Or you check on the statusbar cordova plugin github page there are some ways to change the color of status bar: https://github.com/apache/cordova-plugin-statusbar
For Android:
For iOS
On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by color name.
Supported color names are:
Or
Sets the background color of the statusbar by a hex string.
CSS shorthand properties are also supported.
On WP7 and WP8 you can also specify values as #AARRGGBB, where AA is an alpha value
All you need to do is include this directive in your
app.module.ts
(or whatever it is called).This will handle status bar text color behavior dynamically through the whole application (no need to worry when and where to set something):