[PR #853] [MERGED] Background image support #24344

Open
opened 2026-01-31 09:02:42 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/853
Author: @d-bingham
Created: 5/16/2019
Status: ✅ Merged
Merged: 5/29/2019
Merged by: @zadjii-msft

Base: master ← Head: master


📝 Commits (10+)

  • ef9be82 Initial code check in for background images
  • cd4ec9e Cleaning up whitespace
  • e84583f Whitespace cleanup
  • 0f0fdf6 Added/fixed comments
  • 4b25499 Fixing tabs
  • d02111c Reverting erroneous file add
  • d684ab8 Removing custom enum for image stretching mode and using Windows::UI::Xaml::Media::Stretch instead.
  • 1526049 Removing now-superfluous static_cast when setting stretch mode.
  • f1bf943 Updating code to use wstring_view (per #925)
  • b612dff One last set of wstring -> wstring_view changes

📊 Changes

8 files changed (+277 additions, -12 deletions)

View changed files

📝 src/cascadia/TerminalApp/Profile.cpp (+112 -2)
📝 src/cascadia/TerminalApp/Profile.h (+6 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+111 -10)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalControl/pch.h (+1 -0)
📝 src/cascadia/TerminalSettings/IControlSettings.idl (+3 -0)
📝 src/cascadia/TerminalSettings/TerminalSettings.cpp (+33 -0)
📝 src/cascadia/TerminalSettings/terminalsettings.h (+10 -0)

📄 Description

Summary of the Pull Request

Initial code check-in for background image support. Handles background images themselves, and adds options to profiles.json to control the feature.

References

#833

PR Checklist

  • Closes #833 (Not quite complete as the opacity setting is not fully robust, see below)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated -- Adds (currently undocumented) settings to profiles.json, but profiles.json as a whole does not appear to be documented
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #833 -- aware of the discussion in #833

Detailed Description of the Pull Request / Additional comments

This adds three options to the individual profile options in profile.json:

  • backgroundImage: Expects a Uri which locates an image. This property is optional and defaults to null.
  • backgroundImageOpacity: Expects a number, controls opacity of the background image. Optional and defaults to 1.0.
  • backgroundImageStretchMode: expects one of "none", "fill", "uniform", or "uniformToFill", which controls the stretch mode used -- see documentation here. Optional and defaults to uniformToFill.

Background images are only displayed if useAcrylic is turned off.

One known issue:

backgroundImageOpacity currently only works with respect to the application's default black background and does not respect the profile's background color.

One potential issue:

There's no attempt to handle a failed image load from the Uri; I think it is reasonable to expect the underlying classes (specifically BitmapImage) to handle this gracefully. Additionally, it's unclear how such a failure should be reported to the user (beyond their requested image being displayed as a black console background instead)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/853 **Author:** [@d-bingham](https://github.com/d-bingham) **Created:** 5/16/2019 **Status:** ✅ Merged **Merged:** 5/29/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`ef9be82`](https://github.com/microsoft/terminal/commit/ef9be82e824e5b67d7c7386f8958c3cf201778bd) Initial code check in for background images - [`cd4ec9e`](https://github.com/microsoft/terminal/commit/cd4ec9e8565b46754d04096ff12839f07bd2e432) Cleaning up whitespace - [`e84583f`](https://github.com/microsoft/terminal/commit/e84583f00b0e9420268a36ca2942fb666dc0e3b8) Whitespace cleanup - [`0f0fdf6`](https://github.com/microsoft/terminal/commit/0f0fdf6b1ee9584939f276e2796ca37960b9427e) Added/fixed comments - [`4b25499`](https://github.com/microsoft/terminal/commit/4b25499eb110d7c1f3e6db2baa5b17297ca37461) Fixing tabs - [`d02111c`](https://github.com/microsoft/terminal/commit/d02111c388d7076087bfe86b805b8ac2b49ca6df) Reverting erroneous file add - [`d684ab8`](https://github.com/microsoft/terminal/commit/d684ab8a89e844b53cf2db38ff683337b94c045b) Removing custom enum for image stretching mode and using Windows::UI::Xaml::Media::Stretch instead. - [`1526049`](https://github.com/microsoft/terminal/commit/15260496ed2a17bc77dc75a212446f68c325673b) Removing now-superfluous static_cast when setting stretch mode. - [`f1bf943`](https://github.com/microsoft/terminal/commit/f1bf9439dfe5f7b6ef7d45201be400e1700c9e9b) Updating code to use wstring_view (per #925) - [`b612dff`](https://github.com/microsoft/terminal/commit/b612dff40efc94632baa90916cbc223bb1c684c6) One last set of wstring -> wstring_view changes ### 📊 Changes **8 files changed** (+277 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/Profile.cpp` (+112 -2) 📝 `src/cascadia/TerminalApp/Profile.h` (+6 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+111 -10) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalControl/pch.h` (+1 -0) 📝 `src/cascadia/TerminalSettings/IControlSettings.idl` (+3 -0) 📝 `src/cascadia/TerminalSettings/TerminalSettings.cpp` (+33 -0) 📝 `src/cascadia/TerminalSettings/terminalsettings.h` (+10 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Initial code check-in for background image support. Handles background images themselves, and adds options to profiles.json to control the feature. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References #833 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #833 (Not _quite_ complete as the opacity setting is not fully robust, see below) * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [x] Requires documentation to be updated -- Adds (currently undocumented) settings to profiles.json, but profiles.json as a whole does not appear to be documented * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #833 -- aware of the discussion in #833 <!-- 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 This adds three options to the individual profile options in profile.json: - backgroundImage: Expects a Uri which locates an image. This property is optional and defaults to null. - backgroundImageOpacity: Expects a number, controls opacity of the background image. Optional and defaults to 1.0. - backgroundImageStretchMode: expects one of "none", "fill", "uniform", or "uniformToFill", which controls the stretch mode used -- see [documentation here](https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.stretch?view=netframework-4.8). Optional and defaults to uniformToFill. Background images are only displayed if useAcrylic is turned off. One **known** issue: backgroundImageOpacity currently only works with respect to the application's default black background and does not respect the profile's background color. One _potential_ issue: There's no attempt to handle a failed image load from the Uri; I _think_ it is reasonable to expect the underlying classes (specifically [BitmapImage](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.bitmapimage)) to handle this gracefully. Additionally, it's unclear how such a failure should be reported to the user (beyond their requested image being displayed as a black console background instead) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:02:42 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24344