mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
This adds one _last_ change to the API to allow apps to specify different icons for light and dark mode. If it's important to an app to specify different icons for light vs dark mode, then `IconInfo` is exactly what you want to use. It contains _two_ `IconDataType`s, for two different icons. Simple as that. And to keep things even easier, I slapped on a `IconInfo(string)` constructor, so that you can easily build a `IconInfo` with both icons set to the same string. Especially useful for font icons, which we're using everywhere already. That allows almost all the extensions to have _no code change_ here, so that's super! Some of the places where we were evaluating if an icon existed or not - that needs to move into the view. `ShellPage.xaml.cs` does one variant of that already for `IDetails.HeroImage`. The view is the only part of the app that knows what the theme is. Closes #78
24 lines
779 B
C#
24 lines
779 B
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Microsoft.CmdPal.Extensions;
|
|
|
|
namespace Microsoft.CmdPal.UI.ViewModels;
|
|
|
|
public partial class ProviderSettingsViewModel(CommandProviderWrapper _provider, ProviderSettings _providerSettings) : ObservableObject
|
|
{
|
|
public string DisplayName => _provider.DisplayName;
|
|
|
|
public string ExtensionName => _provider.Extension?.ExtensionDisplayName ?? "Built-in";
|
|
|
|
public IconInfo Icon => _provider.Icon;
|
|
|
|
public bool IsEnabled
|
|
{
|
|
get => _providerSettings.IsEnabled;
|
|
set => _providerSettings.IsEnabled = value;
|
|
}
|
|
}
|