From 1b9898a398dee4e64faca93b8353ab96244bae33 Mon Sep 17 00:00:00 2001 From: StefanGreve Date: Sat, 28 Dec 2024 11:17:54 +0100 Subject: [PATCH] Implement Set-SystemTheme for MacOS --- src/Public/Set-SystemTheme.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Public/Set-SystemTheme.ps1 b/src/Public/Set-SystemTheme.ps1 index 06873eb..b49ce4c 100644 --- a/src/Public/Set-SystemTheme.ps1 +++ b/src/Public/Set-SystemTheme.ps1 @@ -13,7 +13,8 @@ function Set-SystemTheme { } elseif ($IsLinux) { Write-Error $OperatingSystemNotSupportedError -Category NotImplemented -ErrorAction Stop } elseif ($IsMacOS) { - Write-Error $OperatingSystemNotSupportedError -Category NotImplemented -ErrorAction Stop + $IsDarkTheme = $Theme -eq "Dark" + osascript -e "tell application `"System Events`" to tell appearance preferences to set dark mode to $IsDarkTheme" } else { Write-Error $OperatingSystemNotSupportedError -Category NotImplemented -ErrorAction Stop }