Skip to content

Commit 017df14

Browse files
gave92Marco Gavelli
authored andcommitted
Set background color in html
1 parent 966bfca commit 017df14

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/Files.App/UserControls/FilePreviews/HtmlPreview.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
x:Name="WebViewControl"
2121
HorizontalAlignment="Stretch"
2222
VerticalAlignment="Stretch"
23-
Loaded="WebViewControl_Loaded" />
23+
DefaultBackgroundColor="Transparent"
24+
Loaded="WebViewControl_LoadedAsync" />
2425

2526
</Border>
2627
</UserControl>

src/Files.App/UserControls/TerminalView.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ private async void WebViewControl_LoadedAsync(object sender, Microsoft.UI.Xaml.R
144144
var profile = _mainPageModel.TerminalSelectedProfile;
145145
var theme = provider.GetPreInstalledThemes().First(x => x.Id == profile.TerminalThemeId);
146146

147-
WebViewControl.DefaultBackgroundColor = ColorHelpers.FromHex(theme.Colors.Background);
148147
WebViewControl.CoreWebView2.Profile.PreferredColorScheme = (ActualTheme == Microsoft.UI.Xaml.ElementTheme.Dark) ? CoreWebView2PreferredColorScheme.Dark : CoreWebView2PreferredColorScheme.Light;
149148

150149
var size = await CreateXtermViewAsync(options, theme.Colors,
@@ -482,7 +481,6 @@ private async void TerminalView_ActualThemeChanged(Microsoft.UI.Xaml.FrameworkEl
482481
theme.Colors.CursorAccent = backgroundColor;
483482
theme.Colors.Cursor = foregroundColor;
484483

485-
WebViewControl.DefaultBackgroundColor = ColorHelpers.FromHex(backgroundColor);
486484
WebViewControl.CoreWebView2.Profile.PreferredColorScheme = (ActualTheme == Microsoft.UI.Xaml.ElementTheme.Dark) ? CoreWebView2PreferredColorScheme.Dark : CoreWebView2PreferredColorScheme.Light;
487485

488486
var serializedTheme = JsonConvert.SerializeObject(theme.Colors, serializerSettings);

src/Files.App/Utils/Terminal/UI/Build/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ window.createTerminal = (options, theme, keyBindings) => {
6969
}
7070

7171
theme = JSON.parse(theme);
72+
document.body.style.background = theme.background;
7273

7374
window.keyBindings = JSON.parse(keyBindings);
7475
window.hoveredUri = "";
@@ -276,6 +277,7 @@ window.createTerminal = (options, theme, keyBindings) => {
276277
window.changeTheme = (theme) => {
277278
theme = JSON.parse(theme);
278279
term.setOption('theme', theme);
280+
document.body.style.background = theme.background;
279281
}
280282

281283
window.changeOptions = (options) => {

src/Files.App/Utils/Terminal/UI/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)