Windows theme color
Peponi │ 1/14/2025 │ 1m
C#
Win32RegistryThemeColor
Windows theme color
1/14/2025
1m
Peponi
C#
Win32RegistryThemeColor
1. Introduction
상기 그림과 같이, 윈도우에는 색 모드를 설정할 수 있는 옵션이 있다. 다음은 레지스트리 값을 읽어 윈도우 색 모드 설정값
을 얻어오는 방법이다.
값 | 설명 |
---|---|
-1 | 레지스트리 미발견 |
0 | 다크 |
1 | 라이트 |
2. Code
using Microsoft.Win32;
namespace WindowTheme
{
public static class WindowThemeColor
{
public static bool IsDarkTheme()
{
// 1은 라이트, 0은 다크, -1은 못찾았음
int res = (int)Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "AppsUseLightTheme", -1);
return res == 0;
}
}
}