IThemeService.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 namespace Microsoft.CmdPal.UI.ViewModels.Services; 6 7 /// <summary> 8 /// Provides theme-related values for the Command Palette and notifies listeners about 9 /// changes that affect visual appearance (theme, tint, background image, and backdrop). 10 /// </summary> 11 /// <remarks> 12 /// Implementations are expected to monitor system/app theme changes and raise 13 /// <see cref="ThemeChanged"/> accordingly. Consumers should call <see cref="Initialize"/> 14 /// once to hook required sources and then query properties/methods for the current visuals. 15 /// </remarks> 16 public interface IThemeService 17 { 18 /// <summary> 19 /// Occurs when the effective theme or any visual-affecting setting changes. 20 /// </summary> 21 /// <remarks> 22 /// Triggered for changes such as app theme (light/dark/default), background image, 23 /// tint/accent, or backdrop parameters that would require UI to refresh styling. 24 /// </remarks> 25 event EventHandler<ThemeChangedEventArgs>? ThemeChanged; 26 27 /// <summary> 28 /// Initializes the theme service and starts listening for theme-related changes. 29 /// </summary> 30 /// <remarks> 31 /// Safe to call once during application startup before consuming the service. 32 /// </remarks> 33 void Initialize(); 34 35 /// <summary> 36 /// Gets the current theme settings. 37 /// </summary> 38 ThemeSnapshot Current { get; } 39 }