Still WIP
This commit is contained in:
@@ -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()
|
||||
|
||||
|
@@ -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"
|
Reference in New Issue
Block a user