[
https://issues.apache.org/jira/browse/CB-13641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16282742#comment-16282742
]
ASF GitHub Bot commented on CB-13641:
-------------------------------------
IndieSW closed pull request #244: CB-13641: (windows) allow for transparent
splash screen background co…
URL: https://github.com/apache/cordova-windows/pull/244
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/cordova-js-src/splashscreen.js b/cordova-js-src/splashscreen.js
index 99b60d9f..90a63f6d 100644
--- a/cordova-js-src/splashscreen.js
+++ b/cordova-js-src/splashscreen.js
@@ -69,18 +69,21 @@ function readPreferencesFromCfg(cfg, manifest) {
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', '#');
+
+ if (bgColor !== 'transparent') {
+ if (bgColor.length > 7) {
+ // Remove aplha
+ 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)
- };
+ 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 +215,7 @@ function exitFullScreen() {
// Make title bg color match splashscreen bg color
function colorizeTitleBar() {
var appView =
Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
- if (isWin10UWP) {
+ if (isWin10UWP && (typeof titleBgColor !== 'undefined')) {
titleInitialBgColor = appView.titleBar.backgroundColor;
appView.titleBar.backgroundColor = titleBgColor;
@@ -223,7 +226,7 @@ function colorizeTitleBar() {
// Revert title bg color
function revertTitleBarColor() {
var appView =
Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
- if (isWin10UWP) {
+ if (isWin10UWP && (typeof titleInitialBgColor !== 'undefined')) {
appView.titleBar.backgroundColor = titleInitialBgColor;
appView.titleBar.buttonBackgroundColor = titleInitialBgColor;
}
diff --git a/template/www/cordova.js b/template/www/cordova.js
index 778efd23..cc528797 100644
--- a/template/www/cordova.js
+++ b/template/www/cordova.js
@@ -1905,18 +1905,21 @@
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', '#');
- 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 (bgColor !== 'transparent') {
+ if (bgColor.length > 7) {
+ // Remove aplha
+ 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 +2051,7 @@
// Make title bg color match splashscreen bg color
function colorizeTitleBar () {
var appView =
Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
- if (appView.titleBar) {
+ if (appView.titleBar && (typeof titleBgColor !== 'undefined')) {
titleInitialBgColor = appView.titleBar.backgroundColor;
appView.titleBar.backgroundColor = titleBgColor;
@@ -2059,7 +2062,7 @@
// Revert title bg color
function revertTitleBarColor () {
var appView =
Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
- if (appView.titleBar) {
+ if (appView.titleBar && (typeof titleInitialBgColor !==
'undefined')) {
appView.titleBar.backgroundColor = titleInitialBgColor;
appView.titleBar.buttonBackgroundColor = titleInitialBgColor;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Splash screen on Windows does not allow for transparent background color.
> -------------------------------------------------------------------------
>
> Key: CB-13641
> URL: https://issues.apache.org/jira/browse/CB-13641
> Project: Apache Cordova
> Issue Type: Improvement
> Components: cordova-windows
> Affects Versions: [email protected]
> Environment: Windows 10.
> Reporter: Terence Bandoian
> Priority: Trivial
> Labels: newbie
> Fix For: Master
>
>
> The splash screen background color defaults to #464646. In splashscreen.js,
> the background color is expected to be a hex value and values longer than
> seven characters are spliced to remove the alpha channel. The configured
> value could be checked for the value 'transparent' and, in that case, not
> spliced.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]