From 9abe11c9755eedd8c38abe656c5e7ebb8a25af6c Mon Sep 17 00:00:00 2001 From: Chris Titus Tech Date: Tue, 10 Sep 2024 14:01:07 -0500 Subject: [PATCH] Fix Theming --- config/themes.json | 148 +++++++++--------- docs/userguide.md | 4 +- .../private/Install-WinUtilProgramChoco.ps1 | 84 +++++----- functions/public/Invoke-WPFInstall.ps1 | 2 +- xaml/inputXML.xaml | 4 +- 5 files changed, 121 insertions(+), 121 deletions(-) diff --git a/config/themes.json b/config/themes.json index ed46caf7..ce1e9888 100644 --- a/config/themes.json +++ b/config/themes.json @@ -27,19 +27,19 @@ "MicroWinLogoSize": "10", "MicrowinCheckBoxMargin": "-10,5,0,0", - "ProgressBarForegroundColor": "#FFAC1C", + "ProgressBarForegroundColor": "#2e77ff", "ProgressBarBackgroundColor": "Transparent", - "ProgressBarTextColor": "#000000", + "ProgressBarTextColor": "#232629", - "ComboBoxBackgroundColor": "#FFFFFF", - "LabelboxForegroundColor": "#000000", - "MainForegroundColor": "#000000", - "MainBackgroundColor": "#FFFFFF", - "LabelBackgroundColor": "#FFFFFF", - "LinkForegroundColor": "#000000", - "LinkHoverForegroundColor": "#000000", - "GroupBorderBackgroundColor": "#000000", - "ComboBoxForegroundColor": "#000000", + "ComboBoxBackgroundColor": "#F7F7F7", + "LabelboxForegroundColor": "#232629", + "MainForegroundColor": "#232629", + "MainBackgroundColor": "#F7F7F7", + "LabelBackgroundColor": "#F7F7F7", + "LinkForegroundColor": "#232629", + "LinkHoverForegroundColor": "#232629", + "GroupBorderBackgroundColor": "#232629", + "ComboBoxForegroundColor": "#232629", "ButtonFontSize": "12", "ButtonFontFamily": "Arial", @@ -52,65 +52,65 @@ "SearchBarTextBoxFontSize": "12", "SearchBarClearButtonFontSize": "14", - "ButtonInstallBackgroundColor": "#FFFFFF", - "ButtonTweaksBackgroundColor": "#FFFFFF", - "ButtonConfigBackgroundColor": "#FFFFFF", - "ButtonUpdatesBackgroundColor": "#FFFFFF", - "ButtonInstallForegroundColor": "#000000", - "ButtonTweaksForegroundColor": "#000000", - "ButtonConfigForegroundColor": "#000000", - "ButtonUpdatesForegroundColor": "#000000", + "ButtonInstallBackgroundColor": "#F7F7F7", + "ButtonTweaksBackgroundColor": "#F7F7F7", + "ButtonConfigBackgroundColor": "#F7F7F7", + "ButtonUpdatesBackgroundColor": "#F7F7F7", + "ButtonInstallForegroundColor": "#232629", + "ButtonTweaksForegroundColor": "#232629", + "ButtonConfigForegroundColor": "#232629", + "ButtonUpdatesForegroundColor": "#232629", "ButtonBackgroundColor": "#F5F5F5", "ButtonBackgroundPressedColor": "#1A1A1A", "CheckboxMouseOverColor": "#999999", "ButtonBackgroundMouseoverColor": "#C2C2C2", "ButtonBackgroundSelectedColor": "#F0F0F0", - "ButtonForegroundColor": "#000000", + "ButtonForegroundColor": "#232629", "ToggleButtonOnColor": "#2e77ff", "ButtonBorderThickness": "1", "ButtonMargin": "1", "ButtonCornerRadius": "2", - "BorderColor": "#000000", + "BorderColor": "#232629", "BorderOpacity": "0.2", "ShadowPulse": "Forever" }, "Classic": { - "ComboBoxBackgroundColor": "#FFFFFF", - "LabelboxForegroundColor": "#000000", - "MainForegroundColor": "#000000", - "MainBackgroundColor": "#FFFFFF", - "LabelBackgroundColor": "#FFFFFF", - "LinkForegroundColor": "#000000", - "LinkHoverForegroundColor": "#000000", - "GroupBorderBackgroundColor": "#000000", - "ComboBoxForegroundColor": "#000000", + "ComboBoxBackgroundColor": "#F7F7F7", + "LabelboxForegroundColor": "#232629", + "MainForegroundColor": "#232629", + "MainBackgroundColor": "#F7F7F7", + "LabelBackgroundColor": "#F7F7F7", + "LinkForegroundColor": "#232629", + "LinkHoverForegroundColor": "#232629", + "GroupBorderBackgroundColor": "#232629", + "ComboBoxForegroundColor": "#232629", - "ButtonInstallBackgroundColor": "#FFFFFF", - "ButtonTweaksBackgroundColor": "#FFFFFF", - "ButtonConfigBackgroundColor": "#FFFFFF", - "ButtonUpdatesBackgroundColor": "#FFFFFF", - "ButtonInstallForegroundColor": "#000000", - "ButtonTweaksForegroundColor": "#000000", - "ButtonConfigForegroundColor": "#000000", - "ButtonUpdatesForegroundColor": "#000000", + "ButtonInstallBackgroundColor": "#F7F7F7", + "ButtonTweaksBackgroundColor": "#F7F7F7", + "ButtonConfigBackgroundColor": "#F7F7F7", + "ButtonUpdatesBackgroundColor": "#F7F7F7", + "ButtonInstallForegroundColor": "#232629", + "ButtonTweaksForegroundColor": "#232629", + "ButtonConfigForegroundColor": "#232629", + "ButtonUpdatesForegroundColor": "#232629", "ButtonBackgroundColor": "#F5F5F5", "ButtonBackgroundPressedColor": "#1A1A1A", "CheckboxMouseOverColor": "#999999", "ButtonBackgroundMouseoverColor": "#C2C2C2", "ButtonBackgroundSelectedColor": "#F0F0F0", - "ButtonForegroundColor": "#000000", + "ButtonForegroundColor": "#232629", "ToggleButtonOnColor": "#2e77ff" }, "Matrix": { - "ComboBoxBackgroundColor": "#000000", - "LabelboxForegroundColor": "#FFEE58", - "MainForegroundColor": "#9CCC65", - "MainBackgroundColor": "#000000", - "LabelBackgroundColor": "#000000", + "ComboBoxBackgroundColor": "#232629", + "LabelboxForegroundColor": "#81a1c1", + "MainForegroundColor": "#F7F7F7", + "MainBackgroundColor": "#232629", + "LabelBackgroundColor": "#232629", "LinkForegroundColor": "#add8e6", - "LinkHoverForegroundColor": "#FFFFFF", - "ComboBoxForegroundColor": "#FFEE58", + "LinkHoverForegroundColor": "#F7F7F7", + "ComboBoxForegroundColor": "#81a1c1", "ProgressBarForegroundColor": "#222222", "ProgressBarBackgroundColor": "Transparent", @@ -120,30 +120,30 @@ "ButtonTweaksBackgroundColor": "#333333", "ButtonConfigBackgroundColor": "#444444", "ButtonUpdatesBackgroundColor": "#555555", - "ButtonInstallForegroundColor": "#FFFFFF", - "ButtonTweaksForegroundColor": "#FFFFFF", - "ButtonConfigForegroundColor": "#FFFFFF", - "ButtonUpdatesForegroundColor": "#FFFFFF", - "ButtonBackgroundColor": "#000019", - "ButtonBackgroundPressedColor": "#FFFFFF", - "ButtonBackgroundMouseoverColor": "#A55A64", - "ButtonBackgroundSelectedColor": "#FF5733", - "ButtonForegroundColor": "#9CCC65", + "ButtonInstallForegroundColor": "#F7F7F7", + "ButtonTweaksForegroundColor": "#F7F7F7", + "ButtonConfigForegroundColor": "#F7F7F7", + "ButtonUpdatesForegroundColor": "#F7F7F7", + "ButtonBackgroundColor": "#1E3747", + "ButtonBackgroundPressedColor": "#F7F7F7", + "ButtonBackgroundMouseoverColor": "#3B4252", + "ButtonBackgroundSelectedColor": "#5E81AC", + "ButtonForegroundColor": "#F7F7F7", "ToggleButtonOnColor": "#2e77ff", - "BorderColor": "#FFAC1C", - "BorderOpacity": "0.8", + "BorderColor": "#0060CC", + "BorderOpacity": "0.2", "ShadowPulse": "0:0:3" }, "Dark": { - "ComboBoxBackgroundColor": "#000000", - "LabelboxForegroundColor": "#FFEE58", - "MainForegroundColor": "#9CCC65", - "MainBackgroundColor": "#000000", - "LabelBackgroundColor": "#000000", + "ComboBoxBackgroundColor": "#232629", + "LabelboxForegroundColor": "#81a1c1", + "MainForegroundColor": "#F7F7F7", + "MainBackgroundColor": "#232629", + "LabelBackgroundColor": "#232629", "LinkForegroundColor": "#add8e6", - "LinkHoverForegroundColor": "#FFFFFF", - "ComboBoxForegroundColor": "#FFEE58", + "LinkHoverForegroundColor": "#F7F7F7", + "ComboBoxForegroundColor": "#81a1c1", "ProgressBarForegroundColor": "#222222", "ProgressBarBackgroundColor": "Transparent", @@ -153,17 +153,17 @@ "ButtonTweaksBackgroundColor": "#333333", "ButtonConfigBackgroundColor": "#444444", "ButtonUpdatesBackgroundColor": "#555555", - "ButtonInstallForegroundColor": "#FFFFFF", - "ButtonTweaksForegroundColor": "#FFFFFF", - "ButtonConfigForegroundColor": "#FFFFFF", - "ButtonUpdatesForegroundColor": "#FFFFFF", - "ButtonBackgroundColor": "#000019", - "ButtonBackgroundPressedColor": "#9CCC65", - "ButtonBackgroundMouseoverColor": "#FF5733", - "ButtonBackgroundSelectedColor": "#FF5733", - "ButtonForegroundColor": "#9CCC65", + "ButtonInstallForegroundColor": "#F7F7F7", + "ButtonTweaksForegroundColor": "#F7F7F7", + "ButtonConfigForegroundColor": "#F7F7F7", + "ButtonUpdatesForegroundColor": "#F7F7F7", + "ButtonBackgroundColor": "#1E3747", + "ButtonBackgroundPressedColor": "#00CFFF", + "ButtonBackgroundMouseoverColor": "#5E81AC", + "ButtonBackgroundSelectedColor": "#5E81AC", + "ButtonForegroundColor": "#F7F7F7", "ToggleButtonOnColor": "#2e77ff", - "BorderColor": "#FFAC1C" + "BorderColor": "#0b1215" } } diff --git a/docs/userguide.md b/docs/userguide.md index 2aa94df6..a529bb67 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -31,8 +31,8 @@ === "prefer Chocolatey" * Check the `prefer Chocolatey` checkbox - * By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference. - * This preference will be used for all Buttons on the Install page and persist across Winutil restarts + * By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference. + * This preference will be used for all Buttons on the Install page and persist across Winutil restarts ![Install Image](assets/Install-Tab-Dark.png#only-dark) ![Install Image](assets/Install-Tab-Light.png#only-light) diff --git a/functions/private/Install-WinUtilProgramChoco.ps1 b/functions/private/Install-WinUtilProgramChoco.ps1 index b20f4b6f..9e9e08ca 100644 --- a/functions/private/Install-WinUtilProgramChoco.ps1 +++ b/functions/private/Install-WinUtilProgramChoco.ps1 @@ -28,86 +28,86 @@ function Install-WinUtilProgramChoco { <# .SYNOPSIS Initializes an output file by removing any existing file and creating a new, empty file at the specified path. - + .PARAMETER filePath The full path to the file to be initialized. - + .DESCRIPTION This function ensures that the specified file is reset by removing any existing file at the provided path and then creating a new, empty file. It is useful when preparing a log or output file for subsequent operations. - + .EXAMPLE Initialize-OutputFile -filePath "C:\temp\output.txt" #> - + param ($filePath) Remove-Item -Path $filePath -Force -ErrorAction SilentlyContinue New-Item -ItemType File -Path $filePath | Out-Null } - + function Run-ChocoCommand { <# .SYNOPSIS Executes a Chocolatey command with the specified arguments and returns the exit code. - + .PARAMETER arguments The arguments to be passed to the Chocolatey command. - + .DESCRIPTION This function runs a specified Chocolatey command by passing the provided arguments to the `choco` executable. It waits for the process to complete and then returns the exit code, allowing the caller to determine success or failure based on the exit code. - + .RETURNS [int] The exit code of the Chocolatey command. - + .EXAMPLE $exitCode = Run-ChocoCommand -arguments "install 7zip -y" #> - + param ($arguments) return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode } - + function Check-UpgradeNeeded { <# .SYNOPSIS Checks if an upgrade is needed for a Chocolatey package based on the content of a log file. - + .PARAMETER filePath The path to the log file that contains the output of a Chocolatey install command. - + .DESCRIPTION This function reads the specified log file and checks for keywords that indicate whether an upgrade is needed. It returns a boolean value indicating whether the terms "reinstall" or "already installed" are present, which suggests that the package might need an upgrade. - + .RETURNS [bool] True if the log file indicates that an upgrade is needed; otherwise, false. - + .EXAMPLE $isUpgradeNeeded = Check-UpgradeNeeded -filePath "C:\temp\install-output.txt" #> - + param ($filePath) return Get-Content -Path $filePath | Select-String -Pattern "reinstall|already installed" -Quiet } - + function Update-TaskbarProgress { <# .SYNOPSIS Updates the taskbar progress based on the current installation progress. - + .PARAMETER currentIndex The current index of the program being installed or uninstalled. - + .PARAMETER totalPrograms The total number of programs to be installed or uninstalled. - + .DESCRIPTION This function calculates the progress of the installation or uninstallation process and updates the taskbar accordingly. The taskbar is set to "Normal" if all programs have been processed, otherwise, it is set to "Error" as a placeholder. - + .EXAMPLE Update-TaskbarProgress -currentIndex 3 -totalPrograms 10 #> - + param ( [int]$currentIndex, [int]$totalPrograms @@ -115,43 +115,43 @@ function Install-WinUtilProgramChoco { $progressState = if ($currentIndex -eq $totalPrograms) { "Normal" } else { "Error" } $sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state $progressState -value ($currentIndex / $totalPrograms) }) } - + function Install-ChocoPackage { <# .SYNOPSIS Installs a Chocolatey package and optionally upgrades it if needed. - + .PARAMETER Program A string containing the name of the Chocolatey package to be installed. - + .PARAMETER currentIndex The current index of the program in the list of programs to be managed. - + .PARAMETER totalPrograms The total number of programs to be installed. - + .DESCRIPTION This function installs a Chocolatey package by running the `choco install` command. If the installation output indicates that an upgrade might be needed, the function will attempt to upgrade the package. The taskbar progress is updated after each package is processed. - + .EXAMPLE Install-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5 #> - + param ( [string]$Program, [int]$currentIndex, [int]$totalPrograms ) - + $installOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt" Initialize-OutputFile $installOutputFile - + Write-Host "Starting installation of $Program with Chocolatey." - + try { $installStatusCode = Run-ChocoCommand "install $Program -y --log-file $installOutputFile" if ($installStatusCode -eq 0) { - + if (Check-UpgradeNeeded $installOutputFile) { $upgradeStatusCode = Run-ChocoCommand "upgrade $Program -y" Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." }) @@ -171,37 +171,37 @@ function Install-WinUtilProgramChoco { Update-TaskbarProgress $currentIndex $totalPrograms } } - + function Uninstall-ChocoPackage { <# .SYNOPSIS Uninstalls a Chocolatey package and any related metapackages. - + .PARAMETER Program A string containing the name of the Chocolatey package to be uninstalled. - + .PARAMETER currentIndex The current index of the program in the list of programs to be managed. - + .PARAMETER totalPrograms The total number of programs to be uninstalled. - + .DESCRIPTION This function uninstalls a Chocolatey package and any related metapackages (e.g., .install or .portable variants). It updates the taskbar progress after processing each package. - + .EXAMPLE Uninstall-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5 #> - + param ( [string]$Program, [int]$currentIndex, [int]$totalPrograms ) - + $uninstallOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt" Initialize-OutputFile $uninstallOutputFile - + Write-Host "Searching for metapackages of $Program (.install or .portable)" $chocoPackages = ((choco list | Select-String -Pattern "$Program(\.install|\.portable)?").Matches.Value) -join " " if ($chocoPackages) { diff --git a/functions/public/Invoke-WPFInstall.ps1 b/functions/public/Invoke-WPFInstall.ps1 index f1605061..f67c1353 100644 --- a/functions/public/Invoke-WPFInstall.ps1 +++ b/functions/public/Invoke-WPFInstall.ps1 @@ -60,7 +60,7 @@ function Invoke-WPFInstall { if($packagesWinget.Count -gt 0) { Install-WinUtilWinget Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget - + } if($packagesChoco.Count -gt 0) { Install-WinUtilChoco diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index fbf8d35d..fec2e11f 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -217,7 +217,7 @@ - + @@ -228,7 +228,7 @@ - +