Skip to content

[Settings] Replace large PNG from Command Palette page with dynamic background generation#43961

Closed
daverayment wants to merge 3 commits intomicrosoft:mainfrom
daverayment:settings-optimizecmdpalbackground
Closed

[Settings] Replace large PNG from Command Palette page with dynamic background generation#43961
daverayment wants to merge 3 commits intomicrosoft:mainfrom
daverayment:settings-optimizecmdpalbackground

Conversation

@daverayment
Copy link
Collaborator

Summary of the Pull Request

This PR includes code to separately create gradient fills and noise textures. Together, these are used to replace the textured gradient background for the Command Palette settings page, which saves shipping a 2.15 MB PNG.

PR Checklist

  • Closes: #xxx
  • 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
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

A new BackgroundTextureHelper class provides helpers to create:

  1. 'CornerGradients': These are 2x2 pixel ImageSources where you define each corner colour. When assigned to an Image and stretched, the GPU will produce a gradient fill.
  2. Noise texture as ImageSource: This returns a grayscale bitmap ImageSource of the desired dimensions. An intensity parameter can control the strength of the noise. Combine this with opacity settings on the receiver control to dial in the desired effect.
  3. Noise texture as ImageBrush: Creates a noise texture as an ImageBrush.

For the Command Palette background, which is at most 1000x560 pixels, this takes a few milliseconds on my slow laptop, so the texture is deliberately not cached.

The Command Palette settings page's code behind assigns the background gradient and texture in a Loaded handler, using the existing Image element for the gradient and a new Rectangle for the texture.

Validation Steps Performed

  1. Visual comparison:
image (Before on top, after beneath.)
  1. Manual testing in Debug and Release builds to confirm that navigation was unaffected and the ImageSources were correctly GC'ed after navigating away from the page.

@daverayment daverayment added the Product-Settings The standalone PowerToys Settings application label Nov 29, 2025
@jiripolasek
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…sync void method to async Task. Rename method for clarity.
@github-actions

This comment has been minimized.

@github-actions
Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (2)

icf
IRDP

These words are not needed and should be removed irdp

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:daverayment/PowerToys.git repository
on the settings-optimizecmdpalbackground branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/19790290644/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Errors ❌ (1)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ check-file-path 1

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@jiripolasek
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@niels9001
Copy link
Collaborator

@daverayment Oh, just seeing this PR now - this looks really useful for the Windows Community Toolkit, actually? Have you considered adding it?

The design team gave us a gradient that is easier to replicate in XAML, so we have replaced the png with a gradient brush in: #44721. Therefore, closing this PR for now.

@niels9001 niels9001 closed this Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Settings The standalone PowerToys Settings application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants