Skip to content

Instantly share code, notes, and snippets.

@seksenov
Last active June 18, 2018 08:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seksenov/9c526800e8372eebe6e9 to your computer and use it in GitHub Desktop.
Save seksenov/9c526800e8372eebe6e9 to your computer and use it in GitHub Desktop.
function setAppBarColors(brandColorHex, brandColorInactiveHex) {
// Detect if the Windows namespace exists in the global object
if (typeof Windows !== 'undefined') {
var brandColor = hexStrToRGBA(brandColorHex);
var brandColorInactive = hexStrToRGBA(brandColorInactiveHex);
// Get a reference to the App Title Bar
var appTitleBar = Windows.UI.ViewManagement.ApplicationView.getForCurrentView().titleBar;
var black = hexStrToRGBA('#000');
var white = hexStrToRGBA('#FFF');
appTitleBar.foregroundColor = white;
appTitleBar.backgroundColor = brandColor;
appTitleBar.buttonForegroundColor = white;
appTitleBar.buttonBackgroundColor = brandColor;
appTitleBar.buttonHoverForegroundColor = white;
appTitleBar.buttonHoverBackgroundColor = brandColor;
appTitleBar.buttonPressedForegroundColor = brandColor;
appTitleBar.buttonPressedBackgroundColor = white;
appTitleBar.inactiveBackgroundColor = brandColorInactive;
appTitleBar.inactiveForegroundColor = brandColor;
appTitleBar.buttonInactiveForegroundColor = brandColor;
appTitleBar.buttonInactiveBackgroundColor = brandColorInactive;
appTitleBar.buttonInactiveHoverForegroundColor = brandColor;
appTitleBar.buttonInactiveHoverBackgroundColor = brandColorInactive;
appTitleBar.buttonPressedForegroundColor = brandColor;
appTitleBar.buttonPressedBackgroundColor = brandColorInactive;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment