//go:build windows package ui import "golang.org/x/sys/windows/registry" // systemPrefersDark queries the Windows personalization registry key // to find out whether the user picked dark mode for apps. Returns // false on any read error so the default stays "light". func systemPrefersDark() bool { k, err := registry.OpenKey( registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Themes\Personalize`, registry.QUERY_VALUE, ) if err != nil { return false } defer k.Close() v, _, err := k.GetIntegerValue("AppsUseLightTheme") if err != nil { return false } return v == 0 }