Still WIP

This commit is contained in:
Profitroll
2023-01-22 17:53:55 +01:00
parent 67f87e0830
commit 1be317898f
10 changed files with 432 additions and 261 deletions

View File

@@ -1,5 +1,6 @@
import platform
import sys
import sv_ttk
from ctypes import byref, c_int, sizeof, windll
from distutils.version import StrictVersion as Version
from os import system
@@ -17,12 +18,16 @@ def theme_title_bar(window: Union[ThemedTk, Toplevel], mode: Literal["dark", "li
if mode == "dark":
value = 1
#window.configure(background="#1c1c1c")
elif mode == "light":
value = 0
#window.configure(background="#ffffff")
else:
raise ValueError()
try:
sv_ttk.set_theme(mode)
window.update()

View File

@@ -1,5 +1,5 @@
from json import JSONDecodeError, dumps, loads
from typing import Any
from typing import Any, Literal
import darkdetect
@@ -69,14 +69,26 @@ def configGet(key: str, *args: str) -> Any:
this_key = this_key[dict_key]
return this_key[key]
def use_dark_mode() -> bool:
def use_dark_mode(no_config=False) -> bool:
"""Return whether dark mode should be used
### Returns:
* `bool`: True if yes and False if no
"""
if no_config is True:
return bool(darkdetect.isDark())
if configGet("dark_mode_auto") is True:
return bool(darkdetect.isDark())
else:
return configGet("dark_mode")
return configGet("dark_mode")
def get_string_mode() -> Literal["dark", "light"]:
"""Return whether dark mode is used
### Returns:
* `Literal["dark", "light"]`
"""
return "dark" if use_dark_mode() is True else "light"