Skip to content

Commit

Permalink
adapt title bar color to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Sep 4, 2015
1 parent d5b9d17 commit 09e5f30
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
19 changes: 19 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@
<ResourceDictionary Source="StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="TitleBarBackgroundThemeBrush" Color="#FF171717" />
<SolidColorBrush x:Key="TitleBarButtonHoverThemeBrush" Color="#FF343434" />
<SolidColorBrush x:Key="TitleBarButtonPressedThemeBrush" Color="#FF4C4C4C" />
<Color x:Key="TitleBarForegroundColor">#FFFFFF</Color>
<Color x:Key="TitleBarInactiveForegroundColor">#A0A0A0</Color>
</ResourceDictionary>


<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="TitleBarBackgroundThemeBrush" Color="#FFF2F2F2" />
<SolidColorBrush x:Key="TitleBarButtonHoverThemeBrush" Color="#FFCECECE" />
<SolidColorBrush x:Key="TitleBarButtonPressedThemeBrush" Color="#FFB8B8B8" />
<Color x:Key="TitleBarForegroundColor">#000000</Color>
<Color x:Key="TitleBarInactiveForegroundColor">#909090</Color>
</ResourceDictionary>

</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>

Expand Down
27 changes: 27 additions & 0 deletions App.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,33 @@ void App::LaunchApp(ApplicationExecutionState previousState,FileActivatedEventAr
Windows::Foundation::Size minsize = { 320.0f, 320.0f };
ApplicationView::GetForCurrentView()->SetPreferredMinSize(minsize);

//apply theme to title bar
auto titleBar = ApplicationView::GetForCurrentView()->TitleBar;

// set up our brushes
SolidColorBrush^ bkgColor = (SolidColorBrush^)(Current->Resources->Lookup("TitleBarBackgroundThemeBrush"));
SolidColorBrush^ btnHoverColor = (SolidColorBrush^)(Current->Resources->Lookup("TitleBarButtonHoverThemeBrush"));
SolidColorBrush^ btnPressedColor = (SolidColorBrush^)(Current->Resources->Lookup("TitleBarButtonPressedThemeBrush"));
Windows::UI::Color foregroundColor = (Windows::UI::Color)(Current->Resources->Lookup("TitleBarForegroundColor"));
Windows::UI::Color inactiveForegroundColor = (Windows::UI::Color)(Current->Resources->Lookup("TitleBarInactiveForegroundColor"));

// override colors!
titleBar->BackgroundColor = bkgColor->Color;
titleBar->ForegroundColor = foregroundColor;
titleBar->ButtonBackgroundColor = bkgColor->Color;
titleBar->ButtonForegroundColor = foregroundColor;
titleBar->ButtonHoverBackgroundColor = btnHoverColor->Color;
titleBar->ButtonHoverForegroundColor = foregroundColor;
titleBar->ButtonPressedBackgroundColor = btnPressedColor->Color;
titleBar->ButtonPressedForegroundColor = foregroundColor;

titleBar->InactiveBackgroundColor = bkgColor->Color;
titleBar->InactiveForegroundColor = inactiveForegroundColor;
titleBar->ButtonInactiveBackgroundColor = bkgColor->Color;
titleBar->ButtonInactiveForegroundColor = inactiveForegroundColor;



//check license
CheckProductLicense();

Expand Down
2 changes: 1 addition & 1 deletion Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.10.156.0" />
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.11.160.0" />
<mp:PhoneIdentity PhoneProductId="2b9558e5-6253-426c-8989-3284f508e743" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>VBA10</DisplayName>
Expand Down

0 comments on commit 09e5f30

Please sign in to comment.