CB-13641: support transparent splash screen background color. (#245)

diff --git a/cordova-js-src/splashscreen.js b/cordova-js-src/splashscreen.js
index 99b60d9..97fd86c 100644
--- a/cordova-js-src/splashscreen.js
+++ b/cordova-js-src/splashscreen.js
@@ -43,6 +43,7 @@
     PROGRESSRING_BOTTOM_MARGIN = 10; // needed for windows 10 min height window
 
 var bgColor = "#464646",
+    isBgColorTransparent = false,
     titleInitialBgColor,
     titleBgColor,
     autoHideSplashScreen = true,
@@ -69,18 +70,22 @@
         splashImageSrc = schema + ':///' + manifest.getSplashScreenImagePath().replace(/\\/g, '/');
 
         bgColor = cfg.getPreferenceValue('SplashScreenBackgroundColor') || bgColor;
-        bgColor = bgColor.replace('0x', '#').replace('0X', '#');
-        if (bgColor.length > 7) {
-            // Remove aplha
-            bgColor = bgColor.slice(0, 1) + bgColor.slice(3, bgColor.length);
-        }
+        bgColor = bgColor.toLowerCase().replace('0x', '#');
+        isBgColorTransparent = (bgColor === 'transparent');
 
-        titleBgColor = {
-            a: 255,
-            r: parseInt(bgColor.slice(1, 3), 16),
-            g: parseInt(bgColor.slice(3, 5), 16),
-            b: parseInt(bgColor.slice(5, 7), 16)
-        };
+        if (!isBgColorTransparent) {
+            if (bgColor.length > 7) {
+                // Remove alpha
+                bgColor = bgColor.slice(0, 1) + bgColor.slice(3, bgColor.length);
+            }
+
+            titleBgColor = {
+                a: 255,
+                r: parseInt(bgColor.slice(1, 3), 16),
+                g: parseInt(bgColor.slice(3, 5), 16),
+                b: parseInt(bgColor.slice(5, 7), 16)
+            };
+        }
 
         autoHideSplashScreen = readBoolFromCfg('AutoHideSplashScreen', autoHideSplashScreen, cfg);
         splashScreenDelay = cfg.getPreferenceValue('SplashScreenDelay') || splashScreenDelay;
@@ -212,7 +217,7 @@
 // Make title bg color match splashscreen bg color
 function colorizeTitleBar() {
     var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
-    if (isWin10UWP) {
+    if (isWin10UWP && !isBgColorTransparent) {
         titleInitialBgColor = appView.titleBar.backgroundColor;
 
         appView.titleBar.backgroundColor = titleBgColor;
@@ -223,7 +228,7 @@
 // Revert title bg color
 function revertTitleBarColor() {
     var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
-    if (isWin10UWP) {
+    if (isWin10UWP && !isBgColorTransparent) {
         appView.titleBar.backgroundColor = titleInitialBgColor;
         appView.titleBar.buttonBackgroundColor = titleInitialBgColor;
     }
diff --git a/template/www/cordova.js b/template/www/cordova.js
index b412c0f..3d9d414 100644
--- a/template/www/cordova.js
+++ b/template/www/cordova.js
@@ -1879,6 +1879,7 @@
         var PROGRESSRING_BOTTOM_MARGIN = 10; // needed for windows 10 min height window
 
         var bgColor = '#464646';
+        var isBgColorTransparent = false;
         var titleInitialBgColor;
         var titleBgColor;
         var autoHideSplashScreen = true;
@@ -1905,18 +1906,22 @@
                 splashImageSrc = schema + ':///' + manifest.getSplashScreenImagePath().replace(/\\/g, '/');
 
                 bgColor = cfg.getPreferenceValue('SplashScreenBackgroundColor') || bgColor;
-                bgColor = bgColor.replace('0x', '#').replace('0X', '#');
-                if (bgColor.length > 7) {
-                    // Remove aplha
-                    bgColor = bgColor.slice(0, 1) + bgColor.slice(3, bgColor.length);
-                }
+                bgColor = bgColor.toLowerCase().replace('0x', '#');
+                isBgColorTransparent = (bgColor === 'transparent');
 
-                titleBgColor = {
-                    a: 255,
-                    r: parseInt(bgColor.slice(1, 3), 16),
-                    g: parseInt(bgColor.slice(3, 5), 16),
-                    b: parseInt(bgColor.slice(5, 7), 16)
-                };
+                if (!isBgColorTransparent) {
+                    if (bgColor.length > 7) {
+                        // Remove alpha
+                        bgColor = bgColor.slice(0, 1) + bgColor.slice(3, bgColor.length);
+                    }
+
+                    titleBgColor = {
+                        a: 255,
+                        r: parseInt(bgColor.slice(1, 3), 16),
+                        g: parseInt(bgColor.slice(3, 5), 16),
+                        b: parseInt(bgColor.slice(5, 7), 16)
+                    };
+                }
 
                 autoHideSplashScreen = readBoolFromCfg('AutoHideSplashScreen', autoHideSplashScreen, cfg);
                 splashScreenDelay = cfg.getPreferenceValue('SplashScreenDelay') || splashScreenDelay;
@@ -2048,7 +2053,7 @@
         // Make title bg color match splashscreen bg color
         function colorizeTitleBar () {
             var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
-            if (isWin10UWP) {
+            if (isWin10UWP && !isBgColorTransparent) {
                 titleInitialBgColor = appView.titleBar.backgroundColor;
 
                 appView.titleBar.backgroundColor = titleBgColor;
@@ -2059,7 +2064,7 @@
         // Revert title bg color
         function revertTitleBarColor () {
             var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
-            if (isWin10UWP) {
+            if (isWin10UWP && !isBgColorTransparent) {
                 appView.titleBar.backgroundColor = titleInitialBgColor;
                 appView.titleBar.buttonBackgroundColor = titleInitialBgColor;
             }