From d6105a346f5f467216458d44bb78b5e3e338fd7f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 28 Aug 2024 18:46:57 -0700 Subject: [PATCH] Style 'AppWindow' title bar --- .../Backend/Win32ApplicationRunner.cs | 17 +++++++++++++++++ .../ComputeSharp.SwapChain.D2D1.Cli.csproj | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/Win32ApplicationRunner.cs index 599f1f8a..960432e0 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/Win32ApplicationRunner.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Threading; using Microsoft.UI.Dispatching; using Microsoft.UI.Windowing; +using Windows.UI; namespace ComputeSharp.SwapChain.D2D1.Backend; @@ -24,6 +25,22 @@ internal static unsafe class Win32ApplicationRunner appWindow.Title = windowTitle; appWindow.TitleBar.ExtendsContentIntoTitleBar = true; + // Transparent colors for the title bar + appWindow.TitleBar.ForegroundColor = Colors.Transparent; + appWindow.TitleBar.BackgroundColor = Colors.Transparent; + appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; + appWindow.TitleBar.InactiveBackgroundColor = Colors.Transparent; + appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + + // Theme aware colors for the title bar + appWindow.TitleBar.ButtonForegroundColor = Colors.White; + appWindow.TitleBar.ButtonHoverForegroundColor = Colors.White; + appWindow.TitleBar.ButtonPressedForegroundColor = Colors.White; + appWindow.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF); + appWindow.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF); + appWindow.TitleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF); + appWindow.TitleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0); + // Initialize the application application.OnInitialize(appWindow); diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj index ebb4d442..f96c74d2 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj @@ -36,7 +36,6 @@ true false false - false false