Home » U++ Library support » Look and Chameleon Technology » New dark theme thread
Re: New dark theme thread [message #57969 is a reply to message #57967] |
Thu, 06 January 2022 08:44   |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
Tom1 wrote on Wed, 05 January 2022 16:15Mirek,
I thought I could apply custom colors through SColor*_Write(), so I tried this for UWord dropping the following code into the place where default SColors are initilized in ChWin32.cpp:
...
for(sysColor *s = sSysColor; s < sSysColor + __countof(sSysColor); s++) // this also resets all imls via SColorPaper_Write!!!
(*s->set)(sAdjust(Color::FromCR(GetSysColor(s->syscolor))));
SColorDisabled_Write(Color(0x95, 0x95, 0x95));
SColorDkShadow_Write(Color(0x20, 0x20, 0x20));
SColorFace_Write(Color(0x20, 0x20, 0x20));
SColorHighlight_Write(Color(GetSystemAccentColor()));
SColorHighlightText_Write(IsDark(SColorHighlight())?White():Black());
SColorInfo_Write(Color(0x20, 0x20, 0x20));
SColorInfoText_Write(White());
SColorLabel_Write(Color(0x20, 0x20, 0x20)); // White());
SColorLight_Write(Color(0x20, 0x20, 0x20));
SColorLtFace_Write(Color(0x20, 0x20, 0x20));
SColorMark_Write(Color::FromCR(GetSysColor(COLOR_HOTLIGHT)));
SColorMenu_Write(Color(0x20, 0x20, 0x20));
SColorMenuMark_Write(Color::FromCR(GetSysColor(COLOR_HOTLIGHT)));
SColorMenuText_Write(White());
SColorPaper_Write(Color(0x19, 0x19, 0x19));
SColorShadow_Write(Color(0x20, 0x20, 0x20));
SColorText_Write(White());
having first implemented this:
RGBA GetSystemAccentColor(){
RGBA color=Gray(); // Default
#ifdef WIN32
HKEY SWKey;
HKEY MSKey;
HKEY WINKey;
HKEY DWMKey;
LONG Status;
// "Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM"
Status = RegOpenKeyEx(HKEY_CURRENT_USER,TEXT("Software"),0,KEY_READ,&SWKey);
if(Status == ERROR_SUCCESS){
Status = RegOpenKeyEx(SWKey,TEXT("Microsoft"),0,KEY_READ,&MSKey);
if(Status == ERROR_SUCCESS){
Status = RegOpenKeyEx(MSKey,TEXT("Windows"),0,KEY_READ,&WINKey);
if(Status == ERROR_SUCCESS){
Status = RegOpenKeyEx(WINKey,TEXT("DWM"),0,KEY_READ,&DWMKey);
if(Status == ERROR_SUCCESS){
DWORD RegType=REG_DWORD;
DWORD BufferSize=4;
byte pStr[16];
Status=RegQueryValueEx(DWMKey,TEXT("AccentColor"),NULL,&RegType,(LPBYTE)pStr,&BufferSize);
if(Status == ERROR_SUCCESS){
color.a=pStr[3]; // This is ARGB
color.b=pStr[2];
color.g=pStr[1];
color.r=pStr[0];
}
RegCloseKey(DWMKey);
}
RegCloseKey(WINKey);
}
RegCloseKey(MSKey);
}
RegCloseKey(SWKey);
}
if(Status == ERROR_SUCCESS) return color; // Success
#endif
// TODO solve other sources
return color; // Default
}
Some parts of the GUI follow these colors, but many don't. So, the results are mixed with partly unreadable GUI. While the suggested colors are definitely not optimized, could you try the above with both light and dark theme in Windows? I could use some help here in order to get onto the right track in tuning the default theme. UWord seems to be a good place to test as it has many different Ctrls in e.g. Style manager.
Best regards,
Tom
I will, but this frankly seems wrong from outset - you are mixing fixed color values with those got from GetSysColor.
I think we need something really simple here, something like
if(sEmulateDarkTheme) {
SColorPaper_Write(Color(...));
SColorFace_Write(Color(...));
SColorText_Write(Color(...));
SColorHighlight_Write(Color(...));
SColorHighlightText_Write(Color(...));
SColorMenu_Write(Color(...));
}
else
for(sysColor *s = sSysColor; s < sSysColor + __countof(sSysColor); s++) // this also resets all imls via SColorPaper_Write!!!
(*s->set)(sAdjust(Color::FromCR(GetSysColor(s->syscolor))));
(do not bother about defining more colors than you know, those will adjust automatically)
|
|
|
 |
|
New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
By: mr_ped on Mon, 22 April 2019 22:22
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
|
 |
|
Re: New dark theme thread
By: Klugier on Wed, 23 September 2020 00:48
|
 |
|
Re: New dark theme thread
By: mirek on Wed, 23 September 2020 17:30
|
 |
|
Re: New dark theme thread
By: Tom1 on Tue, 21 December 2021 16:32
|
 |
|
Re: New dark theme thread
By: Tom1 on Mon, 03 January 2022 15:28
|
 |
|
Re: New dark theme thread
By: mirek on Wed, 05 January 2022 09:13
|
 |
|
Re: New dark theme thread
By: Tom1 on Wed, 05 January 2022 13:18
|
 |
|
Re: New dark theme thread
By: Tom1 on Wed, 05 January 2022 16:15
|
 |
|
Re: New dark theme thread
By: mirek on Thu, 06 January 2022 08:44
|
 |
|
Re: New dark theme thread
By: mirek on Thu, 06 January 2022 08:46
|
 |
|
Re: New dark theme thread
By: Tom1 on Thu, 06 January 2022 12:34
|
 |
|
Re: New dark theme thread
By: mirek on Thu, 06 January 2022 19:48
|
 |
|
Re: New dark theme thread
By: Tom1 on Fri, 07 January 2022 16:51
|
 |
|
Re: New dark theme thread
By: mirek on Sat, 08 January 2022 14:23
|
 |
|
Re: New dark theme thread
By: Tom1 on Sat, 08 January 2022 17:16
|
 |
|
Re: New dark theme thread
By: Tom1 on Wed, 12 January 2022 09:56
|
 |
|
Re: New dark theme thread
By: Tom1 on Thu, 13 January 2022 13:22
|
 |
|
Re: New dark theme thread
By: mirek on Sun, 16 January 2022 19:15
|
 |
|
Re: New dark theme thread
By: Tom1 on Mon, 17 January 2022 08:50
|
 |
|
Re: New dark theme thread
By: mirek on Mon, 17 January 2022 17:37
|
 |
|
Re: New dark theme thread
By: Tom1 on Tue, 18 January 2022 15:32
|
 |
|
Re: New dark theme thread
By: Alboni on Tue, 17 May 2022 15:16
|
 |
|
Re: New dark theme thread
By: Tom1 on Tue, 17 May 2022 17:54
|
 |
|
Re: New dark theme thread
By: Alboni on Wed, 18 May 2022 15:51
|
 |
|
Re: New dark theme thread
By: superdev on Fri, 26 August 2022 19:35
|
Goto Forum:
Current Time: Fri May 09 14:04:05 CEST 2025
Total time taken to generate the page: 0.00432 seconds
|