ThemeSnapshot.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using Microsoft.UI.Xaml; 6 using Microsoft.UI.Xaml.Media; 7 using Windows.UI; 8 9 namespace Microsoft.CmdPal.UI.ViewModels.Services; 10 11 /// <summary> 12 /// Represents a snapshot of theme-related visual settings, including accent color, theme preference, and background 13 /// image configuration, for use in rendering the Command Palette UI. 14 /// </summary> 15 public sealed class ThemeSnapshot 16 { 17 /// <summary> 18 /// Gets the accent tint color used by the Command Palette visuals. 19 /// </summary> 20 public required Color Tint { get; init; } 21 22 /// <summary> 23 /// Gets the accent tint color used by the Command Palette visuals. 24 /// </summary> 25 public required float TintIntensity { get; init; } 26 27 /// <summary> 28 /// Gets the configured application theme preference. 29 /// </summary> 30 public required ElementTheme Theme { get; init; } 31 32 /// <summary> 33 /// Gets the image source to render as the background, if any. 34 /// </summary> 35 /// <remarks> 36 /// Returns <see langword="null"/> when no background image is configured. 37 /// </remarks> 38 public required ImageSource? BackgroundImageSource { get; init; } 39 40 /// <summary> 41 /// Gets the stretch mode used to lay out the background image. 42 /// </summary> 43 public required Stretch BackgroundImageStretch { get; init; } 44 45 /// <summary> 46 /// Gets the opacity applied to the background image. 47 /// </summary> 48 /// <value> 49 /// A value in the range [0, 1], where 0 is fully transparent and 1 is fully opaque. 50 /// </value> 51 public required double BackgroundImageOpacity { get; init; } 52 53 /// <summary> 54 /// Gets the effective acrylic backdrop parameters based on current settings and theme. 55 /// </summary> 56 /// <returns>The resolved <c>AcrylicBackdropParameters</c> to apply.</returns> 57 public required AcrylicBackdropParameters BackdropParameters { get; init; } 58 59 public required int BlurAmount { get; init; } 60 61 public required float BackgroundBrightness { get; init; } 62 }