cordova-plugin-statusbar-background v1.0.0
:lollipop: cordova-plugin-statusbar-background
This is a simple plugin for Android which will set the window statusbar and background color on start-up for you app's MainActivity to a color of your choice. This allows you to avoid the standard black status bar and dark grey background which will flash for a second before your splash screen appears. Set the color to the same background as your splash screen for a smoother start-up effect.
Installation
You'll need to set your desired window background color while installing the plugin by supplying the BG_SB_COLOR
variable. Set it to whatever you want, preferrably the same color as your splash screen.
cordova plugin add cordova-plugin-statusbar-background --variable BG_SB_COLOR=#ff69b4 --save
Or install directly from this repo:
cordova plugin add https://github.com/Chongas/cordova-plugin-statusbar-background.git --variable BG_SB_COLOR=#ff69b4 --save
Supported Platforms
- Cordova (cordova >=6.2.0)
- Platform Android (cordova-android >=6.0.0)
Configuration
A custom BG_SB_COLOR
variable will be added to your app's config.xml after installation with the value you selected (provided you included the --save
flag).
You can change it whenever you want, but you'll need to remove and re-add the Android platform from your project in order for the change to go through.
<plugin name="cordova-plugin-statusbar-background">
<variable name="BG_SB_COLOR" value="#B4D455" />
</plugin>
To re-add the Android platform:
cordova platform remove android
cordova platform add android
TODO
- Allow an image background to be used as windowBackground? Perhaps set it to the same image as the splash screen automatically?
- Find a way to make changes to config.xml automatically update without having to re-add the platform.
6 years ago