diff --git a/src/cascadia/WpfTerminalControl/TerminalControl.xaml.cs b/src/cascadia/WpfTerminalControl/TerminalControl.xaml.cs
index d5baef5b73f..91dca3a3bd5 100644
--- a/src/cascadia/WpfTerminalControl/TerminalControl.xaml.cs
+++ b/src/cascadia/WpfTerminalControl/TerminalControl.xaml.cs
@@ -76,7 +76,8 @@ public ITerminalConnection Connection
/// The color theme to use in the terminal.
/// The font family to use in the terminal.
/// The font size to use in the terminal.
- public void SetTheme(TerminalTheme theme, string fontFamily, short fontSize)
+ /// Color for the control background when the terminal window is smaller than the hosting WPF window.
+ public void SetTheme(TerminalTheme theme, string fontFamily, short fontSize, Color externalBackground = default)
{
PresentationSource source = PresentationSource.FromVisual(this);
@@ -92,7 +93,12 @@ public void SetTheme(TerminalTheme theme, string fontFamily, short fontSize)
byte g = Convert.ToByte((theme.DefaultBackground >> 8) & 0xff);
byte r = Convert.ToByte(theme.DefaultBackground & 0xff);
- this.terminalGrid.Background = new SolidColorBrush(Color.FromRgb(r, g, b));
+ // Set the background color for the control only if one is provided.
+ // This is only shown when the terminal renderer is smaller than the enclosing WPF window.
+ if (externalBackground != default)
+ {
+ this.Background = new SolidColorBrush(externalBackground);
+ }
}
///
diff --git a/src/cascadia/WpfTerminalControl/TerminalTheme.cs b/src/cascadia/WpfTerminalControl/TerminalTheme.cs
index f0d739e9fcb..976047e2ed1 100644
--- a/src/cascadia/WpfTerminalControl/TerminalTheme.cs
+++ b/src/cascadia/WpfTerminalControl/TerminalTheme.cs
@@ -5,7 +5,6 @@
namespace Microsoft.Terminal.Wpf
{
- using System;
using System.Runtime.InteropServices;
///