Created
August 7, 2015 07:54
-
-
Save stknohg/fd40bf4313a82b8af334 to your computer and use it in GitHub Desktop.
Windows10で暗いテーマカラーを使用するか否かを設定します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Windows10で暗いテーマカラーを使用するか否かを設定します。 | |
.DESCRIPTION | |
設定メニューなどのダイアログは通常明るいテーマ色に設定されていますが、 | |
このファンクションを使うことで"暗い"テーマ色にすることができます。 | |
.PARAMETER Enabled | |
$trueを設定すると"暗い"テーマ色にします。 | |
$falseを設定すると通常のテーマ色に戻します。 | |
.EXAMPLE | |
Use-AppsDarkTheme $true | |
"暗い"テーマ色にします。 | |
.EXAMPLE | |
Use-AppsDarkTheme $false | |
通常のテーマ色に戻します。 | |
.LINK | |
http://www.windowscentral.com/how-enable-dark-theme-windows-10 | |
http://pc.watch.impress.co.jp/docs/news/yajiuma/20150806_715535.html | |
#> | |
function Use-AppsDarkTheme | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory = $true, Position = 0)] | |
[Boolean]$Enabled = $true | |
) | |
# OSバージョンチェック | |
if( [Environment]::OSVersion.Version.Major -lt 10 ) | |
{ | |
Write-Warning "Windows 10以降でのみ実行可能です。" | |
return | |
} | |
# 設定値の判定 | |
$EnableValue = 0 | |
if( -not $Enabled ) | |
{ | |
$EnableValue = 1 | |
} | |
# * リンク先ではHKLMも修正すると記載されていたが、実際にはHKCUだけでも動作したためHKLMの修正はしない様にする。 | |
$PersonalizeRootPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" | |
if( -not ( Test-Path $PersonalizeRootPath ) ) | |
{ | |
New-Item $PersonalizeRootPath | |
} | |
Set-ItemProperty -Path $PersonalizeRootPath -Name "AppsUseLightTheme" -Value $EnableValue -Type DWord | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment