mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
This reverts commit 217f3f9ff3.
This commit is contained in:
@@ -83,6 +83,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
/// </summary>
|
||||
public MarkdownPreviewHandlerControl()
|
||||
{
|
||||
this.SetBackgroundColor(Settings.BackgroundColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -121,11 +122,12 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
_infoBarDisplayed = true;
|
||||
}
|
||||
|
||||
string markdownHTML = FilePreviewCommon.MarkdownHelper.MarkdownHtml(fileText, Common.UI.ThemeManager.GetWindowsBaseColor().ToLowerInvariant(), filePath, ImagesBlockedCallBack);
|
||||
string markdownHTML = FilePreviewCommon.MarkdownHelper.MarkdownHtml(fileText, Settings.GetTheme(), filePath, ImagesBlockedCallBack);
|
||||
|
||||
_browser = new WebView2()
|
||||
{
|
||||
Dock = DockStyle.Fill,
|
||||
DefaultBackgroundColor = Color.Transparent,
|
||||
};
|
||||
|
||||
var webView2Options = new CoreWebView2EnvironmentOptions("--block-new-web-contents");
|
||||
|
||||
44
src/modules/previewpane/MarkdownPreviewHandler/Settings.cs
Normal file
44
src/modules/previewpane/MarkdownPreviewHandler/Settings.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
internal sealed class Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the color of the window background.
|
||||
/// Even though this is not a setting yet, it's retrieved from a "Settings" class to be aligned with other preview handlers that contain this setting.
|
||||
/// It's possible it can be converted into a setting in the future.
|
||||
/// </summary>
|
||||
public static Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GetTheme() == "dark")
|
||||
{
|
||||
return Color.FromArgb(30, 30, 30); // #1e1e1e
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the theme.
|
||||
/// </summary>
|
||||
/// <returns>Theme that should be used.</returns>
|
||||
public static string GetTheme()
|
||||
{
|
||||
return Common.UI.ThemeManager.GetWindowsBaseColor().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user