2026-07-19 22:06:07 +02:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Returns whether Windows apps are configured to use dark mode.
|
|
|
|
|
|
|
|
|
|
.OUTPUTS
|
|
|
|
|
System.Boolean. $false when the personalization setting cannot be read.
|
|
|
|
|
#>
|
|
|
|
|
function Get-SystemUsesDarkMode {
|
2026-02-15 23:08:54 +01:00
|
|
|
try {
|
2026-06-07 22:51:01 +02:00
|
|
|
$personalizeKey = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize'
|
|
|
|
|
|
|
|
|
|
if ($null -eq $personalizeKey) {
|
|
|
|
|
Write-Host "WARNING: Unable to retrieve personalization settings." -ForegroundColor Yellow
|
|
|
|
|
return $false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $personalizeKey.AppsUseLightTheme -eq 0
|
2026-02-15 23:08:54 +01:00
|
|
|
}
|
|
|
|
|
catch {
|
|
|
|
|
return $false
|
|
|
|
|
}
|
|
|
|
|
}
|