fix dialogbox theme (#2490)

This commit is contained in:
MyDrift 2024-08-06 19:57:21 +02:00 committed by GitHub
parent 97e517a9dd
commit 9284741cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,13 +44,14 @@ function Show-CustomDialog {
Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName PresentationFramework
# Define theme colors # Define theme colors
$foregroundColor = [Windows.Media.Brushes]::White $foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
$backgroundColor = [Windows.Media.Brushes]::Black $backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
$font = New-Object Windows.Media.FontFamily("Consolas") $font = New-Object Windows.Media.FontFamily("Consolas")
$borderColor = [Windows.Media.Brushes]::Green $borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
$buttonBackgroundColor = [Windows.Media.Brushes]::Black $buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
$buttonForegroundColor = [Windows.Media.Brushes]::White $buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA") $shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
$logocolor = $sync.configs.themes.$ctttheme.ButtonBackgroundPressedColor
# Create a custom dialog window # Create a custom dialog window
$dialog = New-Object Windows.Window $dialog = New-Object Windows.Window
@ -180,7 +181,7 @@ $cttLogoPath = @"
# Add SVG path # Add SVG path
$svgPath = New-Object Windows.Shapes.Path $svgPath = New-Object Windows.Shapes.Path
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath) $svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
$svgPath.Fill = $foregroundColor # Set fill color to white $svgPath.Fill = $logocolor # Set fill color to white
# Add SVG path to Viewbox # Add SVG path to Viewbox
$viewbox.Child = $svgPath $viewbox.Child = $svgPath
@ -192,7 +193,7 @@ $cttLogoPath = @"
$winutilTextBlock = New-Object Windows.Controls.TextBlock $winutilTextBlock = New-Object Windows.Controls.TextBlock
$winutilTextBlock.Text = "Winutil" $winutilTextBlock.Text = "Winutil"
$winutilTextBlock.FontSize = $HeaderFontSize $winutilTextBlock.FontSize = $HeaderFontSize
$winutilTextBlock.Foreground = $foregroundColor $winutilTextBlock.Foreground = $logocolor
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block $winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
$stackPanel.Children.Add($winutilTextBlock) $stackPanel.Children.Add($winutilTextBlock)
# Add TextBlock for information with text wrapping and margins # Add TextBlock for information with text wrapping and margins
@ -219,18 +220,19 @@ $cttLogoPath = @"
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value) $hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
$hyperlink.Inlines.Add($match.Groups[2].Value) $hyperlink.Inlines.Add($match.Groups[2].Value)
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline $hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
$hyperlink.Foreground = $foregroundColor $hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
$hyperlink.Add_Click({ $hyperlink.Add_Click({
param($sender, $args) param($sender, $args)
Start-Process $sender.NavigateUri.AbsoluteUri Start-Process $sender.NavigateUri.AbsoluteUri
}) })
$hyperlink.Add_MouseEnter({ $hyperlink.Add_MouseEnter({
param($sender, $args) param($sender, $args)
$sender.Foreground = [Windows.Media.Brushes]::LightGray $sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
}) })
$hyperlink.Add_MouseLeave({ $hyperlink.Add_MouseLeave({
param($sender, $args) param($sender, $args)
$sender.Foreground = $foregroundColor $sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
}) })
$messageTextBlock.Inlines.Add($hyperlink) $messageTextBlock.Inlines.Add($hyperlink)