mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
## Summary This PR adds: - Backdrop material customization - Alongside acrylic, the following options are now available: - Transparent background - Mica background - Background material opacity - Lets you control how transparent the background is ## Pictures? Pictures! <img width="1491" height="928" alt="image" src="https://github.com/user-attachments/assets/ff4e9e06-fcf1-4f05-bc0a-fb70dc4f39be" /> https://github.com/user-attachments/assets/84e83279-afab-481e-b904-f054318c5d2f <img width="977" height="628" alt="image" src="https://github.com/user-attachments/assets/241a228d-af3f-448a-94a6-0a282218bd8c" /> ## PR Checklist - [x] Closes: #44197 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
66 lines
2.2 KiB
C#
66 lines
2.2 KiB
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.
|
|
|
|
namespace Microsoft.CmdPal.UI.ViewModels;
|
|
|
|
/// <summary>
|
|
/// Central registry of backdrop style configurations.
|
|
/// </summary>
|
|
public static class BackdropStyles
|
|
{
|
|
private static readonly Dictionary<BackdropStyle, BackdropStyleConfig> Configs = new()
|
|
{
|
|
[BackdropStyle.Acrylic] = new()
|
|
{
|
|
ControllerKind = BackdropControllerKind.Acrylic,
|
|
BaseTintOpacity = 0.5f,
|
|
BaseLuminosityOpacity = 0.9f,
|
|
PreviewBrush = PreviewBrushKind.Acrylic,
|
|
},
|
|
[BackdropStyle.AcrylicThin] = new()
|
|
{
|
|
ControllerKind = BackdropControllerKind.AcrylicThin,
|
|
BaseTintOpacity = 0.0f,
|
|
BaseLuminosityOpacity = 0.85f,
|
|
PreviewBrush = PreviewBrushKind.Acrylic,
|
|
},
|
|
[BackdropStyle.Mica] = new()
|
|
{
|
|
ControllerKind = BackdropControllerKind.Mica,
|
|
BaseTintOpacity = 0.0f,
|
|
BaseLuminosityOpacity = 1.0f,
|
|
PreviewBrush = PreviewBrushKind.Solid,
|
|
FixedOpacity = 0.96f,
|
|
SupportsOpacity = false,
|
|
},
|
|
[BackdropStyle.MicaAlt] = new()
|
|
{
|
|
ControllerKind = BackdropControllerKind.MicaAlt,
|
|
BaseTintOpacity = 0.0f,
|
|
BaseLuminosityOpacity = 1.0f,
|
|
PreviewBrush = PreviewBrushKind.Solid,
|
|
FixedOpacity = 0.98f,
|
|
SupportsOpacity = false,
|
|
},
|
|
[BackdropStyle.Clear] = new()
|
|
{
|
|
ControllerKind = BackdropControllerKind.Solid,
|
|
BaseTintOpacity = 1.0f,
|
|
BaseLuminosityOpacity = 1.0f,
|
|
PreviewBrush = PreviewBrushKind.Solid,
|
|
},
|
|
};
|
|
|
|
/// <summary>
|
|
/// Gets the configuration for the specified backdrop style.
|
|
/// </summary>
|
|
public static BackdropStyleConfig Get(BackdropStyle style) =>
|
|
Configs.TryGetValue(style, out var config) ? config : Configs[BackdropStyle.Acrylic];
|
|
|
|
/// <summary>
|
|
/// Gets all registered backdrop styles.
|
|
/// </summary>
|
|
public static IEnumerable<BackdropStyle> All => Configs.Keys;
|
|
}
|