Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

CB-11836 Allow setting of 'ForegroundText' property via config.xml #195

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions template/cordova/lib/AppxManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,21 @@ AppxManifest.prototype.getVisualElements = function () {
return this.setBackgroundColor(color);
} catch (e) { return this; }
},
getForegroundText: function () {
return visualElements.attrib.ForegroundText;
},
setForegroundText: function (color) {
if (color) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of if (color) { visualElements.attrib.ForegroundText = color; } would it be better to use visualElements.attrib.ForegroundText = color || 'light' so that ForegroundText would be reset as default light if we set dark via preference for example and then remove the preference from config.xml entirely?

// Foreground color can either be dark or light, light is the default
if (color !== 'dark') {
color = 'light';
}

visualElements.attrib.ForegroundText = color;
}

return this;
},
getSplashBackgroundColor: function () {
var splashNode = visualElements.find('./' + self.prefix + 'SplashScreen');
return splashNode && splashNode.attrib.BackgroundColor;
Expand Down
1 change: 1 addition & 0 deletions template/cordova/lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function updateManifestFile (config, manifestPath) {
// Apply background color, splashscreen background color, etc.
manifest.getVisualElements()
.trySetBackgroundColor(config.getPreference('BackgroundColor'))
.setForegroundText(config.getPreference('ForegroundText'))
.setSplashBackgroundColor(config.getPreference('SplashScreenBackgroundColor'))
.setToastCapable(config.getPreference('WindowsToastCapable'))
.setOrientation(config.getPreference('Orientation'));
Expand Down