Closed Zingzy closed 1 year ago
That's the thing I am not working on right now. I have to research about the API on reverting themes back to original.
That's the thing I am not working on right now. I have to research about the API on reverting themes back to original.
No like I only want to remove the border color not any other theme
That's the thing I am not working on right now. I have to research about the API on reverting themes back to original.
also can you mention the API you use to change the window border color? hopefully I can search about some fixes?
@Zingzy
No like I only want to remove the border color not any other theme
Yeah, I mean all those options including the themes.
also can you mention the API you use to change the window border color? hopefully I can search about some fixes?
It's the DWMApi https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute
@Zingzy
No like I only want to remove the border color not any other theme
Yeah, I mean all those options including the themes.
also can you mention the API you use to change the window border color? hopefully I can search about some fixes?
It's the DWMApi https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute
also sir do you know any way on how to get the user's accent color?
@Zingzy I am not sure but DWMGetWindowAttribute or GetThemeSysColor can help. I will try implement this feature later.
@Zingzy I am not sure but DWMGetWindowAttribute can help. I will try implement this feature later.
Ok thanks a lot
Hey bro, need a little help with this issue. I want to get the accent color of windows. I found that GetThemeSysColor attribute can help. Idk, but there can also be a different term for this. Can you help to figure out the correct process of using it with ctypes? I somehow managed to use the term but I don't know how to get the COLOREF value returned.
from ctypes import POINTER, pointer, sizeof, windll, Structure, byref, c_int, c_wchar_p
from ctypes.wintypes import DWORD, ULONG, COLORREF, HANDLE, HWND
...
HWND = windll.user32.GetParent(window.winfo_id())
HTHEME = HANDLE
GetColor = windll.UxTheme.GetThemeSysColor
GetColor.argtypes = [HTHEME, c_int]
GetColor.restype = COLORREF
OpenThemeData = windll.uxtheme.OpenThemeData
OpenThemeData.argtypes = [HWND, c_wchar_p]
OpenThemeData.restype = HTHEME
htheme = OpenThemeData(hWnd, 'Window')
color = GetColor(htheme, c_int(1))
print(color)
Hey bro, need a little help with this issue. I want to get the accent color of windows. I found that GetThemeSysColor attribute can help. Idk, but there can also be a different term for this. Can you help to figure out the correct process of using it with ctypes? I somehow managed to use the term but I don't know how I can get the COLOREF value returned.
from ctypes import POINTER, pointer, sizeof, windll, Structure, byref, c_int, c_wchar_p from ctypes.wintypes import DWORD, ULONG, COLORREF, HANDLE, HWND ... HWND = windll.user32.GetParent(window.winfo_id()) HTHEME = HANDLE GetColor = windll.UxTheme.GetThemeSysColor GetColor.argtypes = [HTHEME, c_int] GetColor.restype = COLORREF OpenThemeData = windll.uxtheme.OpenThemeData OpenThemeData.argtypes = [HWND, c_wchar_p] OpenThemeData.restype = HTHEME htheme = OpenThemeData(hWnd, 'Window') color = GetColor(htheme, c_int(1)) print(color)
Thanks but actually I found a better solution to get the accent color using Registry Keys and about reverting the border color, I detected the original border color of the window and changed it's color to that to remove the custom border
@Zingzy So what is the method for python (getting the accent color)? I wish we can implement this in the package.
@Zingzy So what is the method for python (getting the accent color)? I wish we can implement this in the package.
Should I share the code over here?
@Zingzy Yeah the process of getting the color from registry with python
@Zingzy Yeah the process of getting the color from registry with python
import winreg
def get_accent():
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Microsoft\Windows\DWM')
value, type = winreg.QueryValueEx(key, 'ColorizationAfterglow')
winreg.CloseKey(key)
return hex(value)
@Zingzy Thanks bro, I implemented this successfully.
@Zingzy Thanks bro, I implemented this successfully.
No worries! Did you implement it in this library?
@Zingzy Will update it soon.
@Zingzy Bro what will be the reg key for default border color?
@Zingzy Bro what will be the reg key for default border color?
I didnt use registry to get the default color, I used a color picker application to get the default color (the default color may vary in different versions of windows tho)... Also I think there must be some registry key which contains the default windows border color
Ok, then no need to add this one.
@Zingzy Updated, now we have pywinstyles.get_accent_color()
@Zingzy Updated, now we have
pywinstyles.get_accent_color()
amazing! But you might wanna give me some credits? (its completely upto you tho, I will not mind if you will not 😄)
@Zingzy Ok, will add your name in that section :) https://github.com/Akascape/py-window-styles/blob/e553549b9681c264226fe2dcc9d22a959a82a3bb/pywinstyles/py_win_style.py#L136C5-L136C61
After I have applied the border color , i want to remove it when a user clicks a button, any idea how to do it??