Skip to content

Commit

Permalink
Adds theme support.
Browse files Browse the repository at this point in the history
- Includes: renames ui namespace (app:UI to app::ui).
  • Loading branch information
mntone committed Dec 26, 2022
1 parent f17d98c commit 02ba7ed
Show file tree
Hide file tree
Showing 17 changed files with 604 additions and 70 deletions.
9 changes: 8 additions & 1 deletion src/PositiveDesktop/App.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ namespace PositiveDesktop

//namespace UI {

[default_interface]
[interface_name("INotificationWindow", 880F8DB1-A418-5E9D-9B40-BEF749B8CE62)]
runtimeclass NotificationWindow : Microsoft.UI.Xaml.Window, Microsoft.UI.Xaml.Data.INotifyPropertyChanged
{
void Show(Single visibleDuration);
PositiveDesktop.ViewModels.NotificationWindowViewModel ViewModel;

[interface_name("INotificationWindow2", 73C7067D-7609-579A-903B-0B1DBBAF8B89)]
{
Microsoft.UI.Xaml.Media.Brush Background { get; };
Microsoft.UI.Xaml.Media.Brush Border { get; };
Microsoft.UI.Xaml.Thickness BorderThickness { get; };
}
}
//}
}
6 changes: 3 additions & 3 deletions src/PositiveDesktop/App.xaml.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "pch.h"
#include "App.xaml.h"

namespace app::UI {
namespace app::ui {
winrt::Microsoft::UI::Dispatching::DispatcherQueue gDispatchQueue = nullptr;
}

Expand All @@ -20,8 +20,8 @@ using namespace PositiveDesktop::implementation;
/// </summary>
App::App() {
// Save DispatcherQueue
app::UI::gDispatchQueue = winrt::Microsoft::UI::Dispatching::DispatcherQueue::GetForCurrentThread();
if (!app::UI::gDispatchQueue) {
app::ui::gDispatchQueue = winrt::Microsoft::UI::Dispatching::DispatcherQueue::GetForCurrentThread();
if (!app::ui::gDispatchQueue) {
Exit();
return;
}
Expand Down
54 changes: 52 additions & 2 deletions src/PositiveDesktop/NotificationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,58 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Border BorderBrush="#BEBEC0"
BorderThickness="1">
<Border Background="{x:Bind Background, Mode=OneWay}"
BorderBrush="{x:Bind Border, Mode=OneWay}"
BorderThickness="{x:Bind BorderThickness, Mode=OneWay}"
HighContrastAdjustment="None">
<Border.Resources>
<SolidColorBrush x:Key="WindowFillColorBrush_HighContrast"
Color="{ThemeResource SystemColorWindowColor}" />
<SolidColorBrush x:Key="WindowStrokeColorBrush_HighContrast"
Color="{ThemeResource SystemColorWindowTextColor}" />

<Color x:Key="Windows10WindowFillColor_Dark">#1F1F1F</Color>
<Color x:Key="Windows10WindowFillColor_Light">#E4E4E4</Color>
<StaticResource x:Key="Windows10WindowFillColor_Accent"
ResourceKey="SystemAccentColorDark1" />

<SolidColorBrush x:Key="Windows10WindowFillColorBrush_Dark"
Color="{StaticResource Windows10WindowFillColor_Dark}" />
<SolidColorBrush x:Key="Windows10WindowFillColorBrush_Light"
Color="{StaticResource Windows10WindowFillColor_Light}" />
<SolidColorBrush x:Key="Windows10WindowFillColorBrush_Accent"
Color="{StaticResource Windows10WindowFillColor_Accent}" />

<SolidColorBrush x:Key="Windows10WindowStrokeColorBrush_Dark"
Color="#1F1F1F" />
<SolidColorBrush x:Key="Windows10WindowStrokeColorBrush_Light"
Color="#E4E4E4" />
<SolidColorBrush x:Key="Windows10WindowStrokeColorBrush_Accent"
Color="{ThemeResource SystemAccentColorDark1}" />

<Color x:Key="AcrylicWindowFillTintColor_Dark">#0A0A0A</Color>
<x:Double x:Key="AcrylicWindowFillTintOpacity_Dark">0.7</x:Double>

<Color x:Key="AcrylicWindowFillTintColor_Light">#E4E4E4</Color>
<x:Double x:Key="AcrylicWindowFillTintOpacity_Light">0.6</x:Double>

<StaticResource x:Key="AcrylicWindowFillTintColor_Accent"
ResourceKey="SystemAccentColorDark1" />
<x:Double x:Key="AcrylicWindowFillTintOpacity_Accent">0.8</x:Double>

<SolidColorBrush x:Key="AcrylicWindowStrokeColorBrush"
Color="{ThemeResource SurfaceStrokeColorFlyout}" />
<SolidColorBrush x:Key="AcrylicWindowStrokeColorBrush_Accent"
Color="{ThemeResource SystemAccentColorDark1}" />

<SolidColorBrush x:Key="Windows11WindowFillColorBrush"
Color="{ThemeResource SolidBackgroundFillColorBase}" />
<SolidColorBrush x:Key="Windows11WindowStrokeColorBrush"
Color="{ThemeResource LayerOnMicaBaseAltFillColorDefault}" />
<SolidColorBrush x:Key="MicaWindowStrokeColorBrush"
Color="{ThemeResource LayerOnMicaBaseAltFillColorDefault}" />
</Border.Resources>

<StackPanel Margin="16,12,8,12"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Expand Down
Loading

0 comments on commit 02ba7ed

Please sign in to comment.