mirror of
https://github.com/Cheviiot/Vual.git
synced 2026-08-04 00:07:25 +00:00
v0.2.0
This commit is contained in:
@@ -367,40 +367,3 @@ def apply_theme_to_all(steamapps: Path, theme: str) -> tuple[int, int]:
|
||||
return (success, failed)
|
||||
|
||||
|
||||
def get_current_theme(pfx: Path) -> str | None:
|
||||
"""Detect current theme from prefix colors.
|
||||
|
||||
Returns:
|
||||
"dark", "light", or None if unknown.
|
||||
"""
|
||||
user_reg = pfx / "user.reg"
|
||||
if not user_reg.is_file():
|
||||
return None
|
||||
|
||||
try:
|
||||
content = user_reg.read_text(encoding="utf-8", errors="replace")
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
# Check Window background color
|
||||
match = re.search(r'"Window"="([^"]+)"', content)
|
||||
if not match:
|
||||
return None
|
||||
|
||||
window_color = match.group(1)
|
||||
|
||||
# Dark themes typically have dark Window color
|
||||
parts = window_color.split()
|
||||
if len(parts) == 3:
|
||||
try:
|
||||
r, g, b = int(parts[0]), int(parts[1]), int(parts[2])
|
||||
# If all RGB < 100, it's dark
|
||||
if r < 100 and g < 100 and b < 100:
|
||||
return "dark"
|
||||
# If all RGB > 200, it's light
|
||||
if r > 200 and g > 200 and b > 200:
|
||||
return "light"
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user