mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
Add the option to change the UI Theme at runtime (#2693)
* Setup for testing * Working Example for Background * Almost all MainBackgrounColor working * Random Color PoC * Fix DBorderColor * prevent old logic from replacing colors in memory at startup * Comment out resources in xaml * Finish new Button * Remove Pulse, Load Windows default Theme * Fix Colors * Fix Toggle Colors * working version, with shared still being mostly applied be replace instead of resouces * Load all entries in themes.json as Resource and reference them in inputXML.xaml * Rename File to match Function Name * Hotfix for Sync with main * Remove Static Set-WinUtilUITheme function/file * Rename File and Function * Cleanup and Stuff * Unify Button Theme with rest of UI * Refactor/Optimazation * Performance optimization * Add Comments * Rename Functions and Variables to be more concise and descriptive * Add persistence to the user Theme Preference across winutil restarts * Reimplement Theme Chagnes from #2722 * Add AUTO option to follow window theme and add dropdown instead toggle * Formatting and deleting temp file * Fix small display bug where Dropdown would remain open for settings and themes * Remove terniary operators because only PS7+ is supported
This commit is contained in:
@ -33,25 +33,25 @@ function Show-CustomDialog {
|
||||
#>
|
||||
param(
|
||||
[string]$Message,
|
||||
[int]$Width = 300,
|
||||
[int]$Height = 200,
|
||||
[int]$FontSize = 10,
|
||||
[int]$HeaderFontSize = 14,
|
||||
[int]$IconSize = 25,
|
||||
[int]$Width = $sync.Form.Resources.CustomDialogWidth,
|
||||
[int]$Height = $sync.Form.Resources.CustomDialogHeight,
|
||||
[int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
|
||||
[int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
|
||||
[int]$IconSize = $sync.Form.Resources.CustomDialogLogoSize,
|
||||
[bool]$EnableScroll = $false
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Define theme colors
|
||||
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
|
||||
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
|
||||
$foregroundColor = $sync.Form.Resources.MainForegroundColor
|
||||
$backgroundColor = $sync.Form.Resources.MainBackgroundColor
|
||||
$font = New-Object Windows.Media.FontFamily("Consolas")
|
||||
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
|
||||
$borderColor = $sync.Form.Resources.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor
|
||||
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
||||
$logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor
|
||||
$logocolor = $sync.Form.Resources.LabelboxForegroundColor
|
||||
|
||||
# Create a custom dialog window
|
||||
$dialog = New-Object Windows.Window
|
||||
@ -162,7 +162,7 @@ function Show-CustomDialog {
|
||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$hyperlink.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
|
||||
$hyperlink.Add_Click({
|
||||
param($sender, $args)
|
||||
@ -170,11 +170,11 @@ function Show-CustomDialog {
|
||||
})
|
||||
$hyperlink.Add_MouseEnter({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
|
||||
$sender.Foreground = $sync.Form.Resources.LinkHoverForegroundColor
|
||||
})
|
||||
$hyperlink.Add_MouseLeave({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$sender.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
})
|
||||
|
||||
$messageTextBlock.Inlines.Add($hyperlink)
|
||||
|
Reference in New Issue
Block a user