Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Look and Chameleon Technology » Dark theme issues
Dark theme issues [message #51581] Thu, 18 April 2019 12:43 Go to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
Tom1 wrote on Thu, 18 April 2019 11:30
Hi cbpporter,

Dark theme is enabled in Windows 10 using Settings > Colors > Choose your default app mode > Dark

Then restart TheIDE.

Best regards,

Tom

Thanks! I mean more like in code, how to turn on CtrlLib dark mode.

Found it in GIT: Ctrl::SetDarkThemeEnabled();

But... sweet baby Jesus, my eyes! I do not mean to be rude or anything, but those colors... That contrast... That Cyan text if you switch code editor to dark mode in TheIDE. That color scheme is completely unusable. It makes my eyes bleed. And literally hurt.

Again, not to be rude, but to avoid personal bias, I showed the theme to about 5 people and we had a good time. Except for the eye bleeding...

Not to mention that it is buggy and once I switched CodeEditor to dark mode, switching it to light mode doesn't work and restoring defaults.

I need to delete settings to get things back to normal...

We need something like SetDarkIconsEnabled which is independent on SetDarkThemeEnabled, maybe support for two color icons...

And a serious pass on the colors...

I tried to change the colors but it is not as simple as it sounds because of TheIDE: I noticed that several parts of TheIDE and CodeEditor work differently when together or used separately, probably because TheIDE micros and sets stuff multiple times in different points. So changing test application was easy, changing TheIDE very hard.

Chameleon needs refactoring.

Still, after about 15 minutes of work, see the attached screenshot.

I am not a graphics designer...
  • Attachment: darkmode.png
    (Size: 203.49KB, Downloaded 432 times)
Re: U++ 2019.1.rc4 released [message #51582 is a reply to message #51581] Thu, 18 April 2019 13:01 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
Oh, and calling Ctrl::SetDarkThemeEnabled() with Windows set to light theme causes problems both in TheIDE and test app. Calling Ctrl::ReSkin() after fixes these problems but now the theme is white.

Chameleon really needs to read and write themes once, respect what you tell it to do and have a clear point after which you can make changes that are never lost by random CtrlCore behavior.

Calling SetDarkThemeEnabled once in GUI_APP_MAIN should be enough for that application to be dark forever. Then you should be able to change ink from black to Color(51, 51, 51) and this change to be respected forever.

If this can't be done with the current API, we need a new Theme class that is always respected and just change themes as monoliths.

This reminds me of my work many years ago in bazaar/Theme, where you had to Apply the theme in a very specific semi-magical way for it reliably work... I no longer remember too many details about working with Chameleon and no longer have an intuitive grasp on what a "color shadow" means, so I can't pick the colors perfectly...
Re: U++ 2019.1.rc4 released [message #51584 is a reply to message #51581] Thu, 18 April 2019 13:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 18 April 2019 12:43
Tom1 wrote on Thu, 18 April 2019 11:30
Hi cbpporter,

Dark theme is enabled in Windows 10 using Settings > Colors > Choose your default app mode > Dark

Then restart TheIDE.

Best regards,

Tom

Thanks! I mean more like in code, how to turn on CtrlLib dark mode.

Found it in GIT: Ctrl::SetDarkThemeEnabled();

But... sweet baby Jesus, my eyes! I do not mean to be rude or anything, but those colors... That contrast... That Cyan text if you switch code editor to dark mode in TheIDE. That color scheme is completely unusable. It makes my eyes bleed. And literally hurt.

Again, not to be rude, but to avoid personal bias, I showed the theme to about 5 people and we had a good time. Except for the eye bleeding...

Not to mention that it is buggy and once I switched CodeEditor to dark mode, switching it to light mode doesn't work and restoring defaults.

I need to delete settings to get things back to normal...

We need something like SetDarkIconsEnabled which is independent on SetDarkThemeEnabled, maybe support for two color icons...

And a serious pass on the colors...


Your post is confusing, I am really not able to tell what you are speaking about...

Are you annoyed by colors in theide editor in the dark mode? (If so, welcome to the club, I dislike it too. But then I really dislike dark theme itself, so who am I to judge...).

SetDarkThemeEnabled tells U++ that application is ready to handle the dark theme. It in fact has any meaning only in windows. If you activate that, app starts following theme setting in Windows 10.
Re: U++ 2019.1.rc4 released [message #51585 is a reply to message #51582] Thu, 18 April 2019 13:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 18 April 2019 13:01
Oh, and calling Ctrl::SetDarkThemeEnabled() with Windows set to light theme causes problems both in TheIDE and test app. Calling Ctrl::ReSkin() after fixes these problems but now the theme is white.

Chameleon really needs to read and write themes once, respect what you tell it to do and have a clear point after which you can make changes that are never lost by random CtrlCore behavior.

Calling SetDarkThemeEnabled once in GUI_APP_MAIN should be enough for that application to be dark forever. Then you should be able to change ink from black to Color(51, 51, 51) and this change to be respected forever.


Really not sure what you are trying to do. U++ is designed in a way that the look&feel is set at the start of app and should not change after that point.

theide works quite well in both dark and light.

There is one issue which is maybe confusing. The editor highlighting settings are INDEPENDENT. Yes, on the first start light or dark theme is loaded based on current schema, but then it stays at colors selected. The reason is simple: colors are user settings, so you cannot change them at start. Users who want to adjust settings would not be happy about it...

Mirek
Re: U++ 2019.1.rc4 released [message #51587 is a reply to message #51585] Thu, 18 April 2019 14:02 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
The issues is that TheIDE CtrlCore constantly overrides your changes. In a very counter-intuitive way. Chameleon has been doing this for over a decade now. If you want to correct something, you can't easily do it. If you want to implement your own theme on top of the current dark mode? It is fairly hard. It is fairly hard to force a dark app on a light windows or the other way around. Making TheIDE do the same thing is even harder because it also constantly overrides you changes in many places. The same for code editor.

Chameleon has always been a bit hard to use and counter-intuitive.

As an example, the newest addition: SetDarkThemeEnabled. This should set your app to dark theme. Always. Without asking the operating system in 1000 places if IsDarkTheme.

Quote:
SetDarkThemeEnabled tells U++ that application is ready to handle the dark theme. It in fact has any meaning only in windows. If you activate that, app starts following theme setting in Windows 10.

IMHO that is a counter-intuitive and problematic design. SetDarkThemeEnabled means "Set my theme to dark": change colors and skins.

Why cant U++ detect multiple themes and be coded to religiously follow those themes. So that if you change them, I don't have to track down dozen of places to make things just work.

I would use a design where you have a Theme, all theme aware components just read from the theme, nobody can write, the theme knows if it is dark or now (you can use heuristics if not sure) and then people are free to update that theme. The system would auto-detect the theme before GUI_APP_MAIN, produce both light an dark versions, and then you in GUI_APP_MAIN can produce a new theme based on both, set the theme without ruining the originals and things should just work.

In short, two phases:
- auto-detect and build several themes
- use the theme (just set a pointer and force the gui to refresh)

And negative icons must be turned on or off independently from any setting. All my hand inverted dark mode icons are now auto-inverted and made ugly.

Been though this multiple times, but never arrived to a final perfect dark mode skin.

I'm currently googling samples, this is the best I found for full GUI.
https:// www.reddit.com/r/Unity3D/comments/9reqtm/i_wasnt_planning_on _sharing_this_so_early_but/

I'll continue searching and am open to suggestions. If anybody knows a good dark UI that is easy to copy, please let me know.
Re: U++ 2019.1.rc4 released [message #51588 is a reply to message #51587] Thu, 18 April 2019 14:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 18 April 2019 14:02
The issues is that TheIDE CtrlCore constantly overrides your changes. In a very counter-intuitive way. Chameleon has been doing this for over a decade now. If you want to correct something, you can't easily do it. If you want to implement your own theme on top of the current dark mode? It is fairly hard. It is fairly hard to force a dark app on a light windows or the other way around. Making TheIDE do the same thing is even harder because it also constantly overrides you changes in many places. The same for code editor.

Chameleon has always been a bit hard to use and counter-intuitive.


Maybe because the problem itself is hard and counterintiutive?

Anyway, missing docs about Chameleon is not helping. Will try to fix than.

Quote:

Quote:
SetDarkThemeEnabled tells U++ that application is ready to handle the dark theme. It in fact has any meaning only in windows. If you activate that, app starts following theme setting in Windows 10.

IMHO that is a counter-intuitive and problematic design. SetDarkThemeEnabled means "Set my theme to dark": change colors and skins.


OK, we can argue about the name and I am willing to change it. But I really need that function to do exactly what it does.

Quote:

Why cant U++ detect multiple themes and be coded to religiously follow those themes. So that if you change them, I don't have to track down dozen of places to make things just work.

I would use a design where you have a Theme, all theme aware components just read from the theme, nobody can write, the theme knows if it


Thats centralized model which is not extensible - that is the issue I wanted to avoid.

Quote:

- use the theme (just set a pointer and force the gui to refresh)


void Ctrl::SetSkin(void (*_skin)())

Mirek

[Updated on: Thu, 18 April 2019 14:13]

Report message to a moderator

Re: U++ 2019.1.rc4 released [message #51589 is a reply to message #51588] Thu, 18 April 2019 14:29 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
OK, let's go in order.

Before the dark mode support, setting dark mode in Windows didn't work. So clearly it is not a "simple" issue of applying a system theme, because most applications ignore that windows option.

So U++ creates this new dark theme.

So my questions are:
- how do you activate dark theme in any app once, and have it work forever? Even if Windows is in light mode. Same for light mode.
- how do you detect which mode it is. I want: if (isdarkmode) setdarkmode else setlightmode. That is a nice intuitive model.
- how do you do a few basic changes to it, like SColorPaper_Write(Color(51, 51, 51)) and force this change forever?
- how do you do the same for TheIDE, because things that work in normal apps need special extra work for TheIDE.

Quote:
Thats centralized model which is not extensible - that is the issue I wanted to avoid.

It looks like to me like you achieved the exact opposite, with Chameleon doing its own thing and being super hard to reliably and intuitively override. Is there anybody who ever had luck with doing anything in Chameleon except for me 10 years ago?

This invisible magic macro system is IMHO in no way superior to a non-extensible simple deign and the non-extensible bit is arguable. There is nothing non-extensible about it because you don't need to extend upon it. For years now people have been able to define incredibly diverse themes with a CSS and a bunch of pictures.

Case in point:
void Ctrl::SetSkin(void (*_skin)())

It is not clear what it does and there are 100 more ways to touch skins. I remember now, but my bazaar/Theme did not call this function and in consequence you couldn't reliably change the theme after program launch. So GUI elements and colors updated, some didn't. So I decided back then to set the them as the first thing in the program.
Re: U++ 2019.1.rc4 released [message #51590 is a reply to message #51589] Thu, 18 April 2019 14:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 18 April 2019 14:29
OK, let's go in order.

Before the dark mode support, setting dark mode in Windows didn't work. So clearly it is not a "simple" issue of applying a system theme, because most applications ignore that windows option.


Well, the real secret is that Windows does not really support dark theme for Win32 apps....

So what we do is to detect the fact that win10 is in dark theme, then roll out our own based on DarkTheme versions of system colors.

Quote:

So my questions are:
- how do you activate dark theme in any app once, and have it work forever? Even if Windows is in light mode. Same for light mode.


Do not call DarkThemeEnabled. It does something else.

Create dark theme skin. That must be a function that sets everything to your desired colors.

Use SetSkin.

Quote:

Case in point:
void Ctrl::SetSkin(void (*_skin)())

It is not clear what it does and there are 100 more ways to touch skins.


There are 100 ways to touch the skin, BUT you are supposed to do them in skin routine.

So basically it does what you would want from SetTheme(Theme *). But the advantage is that you inherit some default skin which you are changing and you can even call "subskin" routines there.

I agree that more docs and some cleanup would be nice, but the basic idea is IMO sound.

Mirek
Re: U++ 2019.1.rc4 released [message #51591 is a reply to message #51590] Thu, 18 April 2019 15:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
P.S.: WRT to .iml being automatically converted, I agree that is rough edge and I have introduced that with great hesitation and still feel uneasy about it. What I know is that 'something like that' is needed. Also note that the whole issue is recent addition and perhaps it really was a mistake to rush into it. What is done is done though...

The problem there is that the number of icons increases quickly. For UHD we have two variants, now with dark mode, it would be 4. Maybe it was mistake to introduce .iml model with "HiDPI" / "Normal" / "Raw" setting per icon. Perhaps we should rather have whole .iml sets and icons would default to "normal" set and be converted only if not found in given set?

Re: U++ 2019.1.rc4 released [message #51595 is a reply to message #51590] Thu, 18 April 2019 20:31 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
mirek wrote on Thu, 18 April 2019 15:54

I agree that more docs and some cleanup would be nice, but the basic idea is IMO sound.

Let's agree to disagree on this one Smile.

Everything is a singleton and U++ often updates stuff in a surprising fashion. And there are macros involved. When choosing color at runtime, I can't write code like: oh, it looks like I'm using black ink on black paper. This is what the curent theme asks of me. The curent theme is dark. Let me see if the system theme does not have a light color for this element?

And this extends to CodeEditor too. If you make those colors work and be different for several programming languages, like when writing an IDE, dark and light theme, plus user profiles you can load or save, the whole updating singletons does not look like a good idea to me. I've been struggling with this for a long time. I remember for months when a single background color would not update because you had to update it outside of CodeEditor or vice-versa.

Tomorrow I'll continue investigating dark mode and see if I can can turn this mess into a half decent looking skin.

So how do you activate the dark theme in an application using SetSkin, let's say in AddressBook.

Other things:
- Icons: at the very least icons must have a flag. If checked, U++ should draw them as they are. And also a way to disable all UHD and sizing shenanigans.
- Not just icons, but everything else needs to have light mode/dark mode override. Like in TheIDE, as you described and I have noticed, CodeEditor and GUI light/dark mode are separate. This is perfectly fine, as long as each knows if it is dark/light and can access both light and dark colors at the same time. So singleton SColorFace just won't do.
- The standard U++ set skin code must set the controls/icons dark/light flag on request and only then.

Tomorrow I will go over all the colors, replace them with red and blue, see how they work and what they affect and hopefully correct this theme problem for my apps, if not for TheIDE.

The problem is that I'm not good at graphics design. I would certainly pay an affordable to designer to create a professional GUI theme. Until then all I can do is look at screenshots on the Internat and try out colors and skins.

I'm also thinking of replacing icons with SVG ans scale them on app activation, but like I said in a post, SVG are drawn with white background and that is nonsensical. Default should be Null color. Another thing to fork.
Re: U++ 2019.1.rc4 released [message #51596 is a reply to message #51595] Thu, 18 April 2019 21:49 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
PS: We also need a UI Demo with most widgets and quick toggles for testing all skins.

That's how I'll start working tomorrow.

My latest plan for a first trial: rip off MacOS...
Re: U++ 2019.1.rc4 released [message #51602 is a reply to message #51595] Fri, 19 April 2019 12:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Thu, 18 April 2019 20:31

- Icons: at the very least icons must have a flag. If checked, U++ should draw them as they are. And also a way to disable all UHD and sizing shenanigans.


Yeah, well, but they do.... Right-click on the icon and select "Raw".

Mirek
Re: U++ 2019.1.rc4 released [message #51605 is a reply to message #51602] Fri, 19 April 2019 12:57 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
mirek wrote on Fri, 19 April 2019 13:30
cbpporter wrote on Thu, 18 April 2019 20:31

- Icons: at the very least icons must have a flag. If checked, U++ should draw them as they are. And also a way to disable all UHD and sizing shenanigans.


Yeah, well, but they do.... Right-click on the icon and select "Raw".

Mirek

Sorry, can't find it.

I attached in screenshot what I see when right-clicking or double clicking.

  • Attachment: icon.png
    (Size: 22.95KB, Downloaded 332 times)
Re: U++ 2019.1.rc4 released [message #51606 is a reply to message #51605] Fri, 19 April 2019 13:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
Sorry, "None".

Mirek
Re: U++ 2019.1.rc4 released [message #51607 is a reply to message #51606] Fri, 19 April 2019 13:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
(I have moved topic where it belongs...)
Re: U++ 2019.1.rc4 released [message #51608 is a reply to message #51606] Fri, 19 April 2019 14:01 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
mirek wrote on Fri, 19 April 2019 14:09
Sorry, "None".

Mirek

So:
1. If I want to turn off icon inverting as a whole in a dark mode application, how do I do that? You can't invert icons too easily because inverting for dark mode requires the inversion of fades and shadows, but only slight adjustments to non fades. (sample)
2. After I turned off only icon inverting for the dark mode application, how do I detect if it is dark mode so I can change all my icons to proper dark mode variants?
2. How do I turn off invert for a single icon without changing UHD?
Re: U++ 2019.1.rc4 released [message #51609 is a reply to message #51608] Fri, 19 April 2019 14:15 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
SetDarkThemeEnabled needs a lot of explanations.

Test scenario.

	Ctrl::SetDarkThemeEnabled();
	Ctrl::SetSkin(ChClassicSkin);


Scenario explanation: app start in dark mode and looks ugly. You select ChClassicSkin to return to a usable UI. Doesn't work.

Interesting behavior:
	Ctrl::SetSkin(ChClassicSkin);
	Ctrl::SetDarkThemeEnabled();


The app looks completely different if I just swap the two statement around.

That's why I'm saying: dark mode needs to be more of its own thing that you can select instead of having such a complex an unmanageable interaction with everything else. Dark mode just needs to set things to dark without having complex system wide repercussions and changing the way some colors are computed.

I'll go over all the widgets and make a complete list of things that need to be updated by dark mode.

So far all frames need to be updated and made (more) Chameleon aware.
Re: U++ 2019.1.rc4 released [message #51610 is a reply to message #51609] Fri, 19 April 2019 14:55 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1412
Registered: September 2007
Ultimate Contributor
I'm close to getting a workable system for themeing that does not need U++ changes (maybe something minor) but lives peacefully together.

What I want to do is have choice in what theme to use.

	if(Ctrl::IsDarkThemeEnabled() && IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW))))
		sEmulateDarkTheme = true;


So basically if IsDarkThemeEnabled and the system is dark themed, we use dark theme.

Here is where I want more control. I want all valid combinations of system dark theme and app dark theme, so 4 combinations.

We need to adjust this condition a bit.

I propose we rename IsDarkThemeEnabled, in something like IsDarkModePermited and add a new IsDarkThemeEnabled, geter and seter, where the user can choose if the skin is dark. SetDarkThemeEnabled would be called set as is today, with IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW))), but NOT in ChSysInit. Before, on system startup, so auto-detection is correct, but I can override it later.

Of course, this is just an option. Here is what I want:

// autodetect light or dark
void SetHostSkin() {
	Ctrl::SetDarkThemeEnabled();
	Ctrl::SetSkin(ChHostSkin);
}

// always light
void SetLightHostSkin() {
	Ctrl::SetDarkThemeEnabled(false);
	Ctrl::SetSkin(ChHostSkin);
}

// always dark
void SetDarkHostSkin() {
	Ctrl::SetDarkThemeEnabled(true);
	Ctrl::ForceDarkSkin(true);
	Ctrl::SetSkin(ChHostSkin);
}

// old, unchaged
void SetStdSkin() {
	Ctrl::SetDarkThemeEnabled(false);
	Ctrl::SetSkin(ChStdSkin);
}

// old, unchaged
void SetClassicSkin() {
	Ctrl::SetDarkThemeEnabled(false);
	Ctrl::SetSkin(ChClassicSkin);
}

// my fixed version
void SetNewDarkHostSkin() {
	Ctrl::SetDarkThemeEnabled(false);
	Ctrl::SetSkin(ChHostSkin);
	
	// do fixes
	
	Ctrl::ReSkin();
}


I managed to do this, except for forcing dark skin on light skin windows. Hence the Ctrl::ForceDarkSkin(true); or the proposed rename mentioned above.




[Updated on: Fri, 19 April 2019 14:58]

Report message to a moderator

Re: U++ 2019.1.rc4 released [message #51611 is a reply to message #51608] Fri, 19 April 2019 15:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
cbpporter wrote on Fri, 19 April 2019 14:01
mirek wrote on Fri, 19 April 2019 14:09
Sorry, "None".

Mirek

So:
1. If I want to turn off icon inverting as a whole in a dark mode application, how do I do that? You can't invert icons too easily because inverting for dark mode requires the inversion of fades and shadows, but only slight adjustments to non fades. (sample)
2. After I turned off only icon inverting for the dark mode application, how do I detect if it is dark mode so I can change all my icons to proper dark mode variants?
2. How do I turn off invert for a single icon without changing UHD?


Long story short: Wait till next week....

Mirek
Re: U++ 2019.1.rc4 released [message #51626 is a reply to message #51611] Mon, 22 April 2019 10:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
https://www.ultimatepp.org/forums/index.php?t=msg&th=106 59&start=0&
Previous Topic: Look of focused button
Next Topic: LabelBox style
Goto Forum:
  


Current Time: Sun Nov 10 20:58:28 CET 2024

Total time taken to generate the page: 0.02542 seconds