Forum > Win32/64

Menu Colors

<< < (2/2)

dbannon:
Thanks wp, you have actually given me a big hint there. I prefer (almost universally) to work under Linux but the issue I am trying to solve is a windows one.  If that onDraw event is fired in Windows, I need to swallow my pride and reboot !

-- but ---

The app is cross platform and I am not all that sure I want to add a whole set of new components just to get dark theme working on windows, it works fine 'out of the box' on linux but thats because Linux has been doing dark themes for years. Windows has only just dipped their toe in the water.

Honestly, rather than hacking away, maybe I'd be better to wait until 'someone' makes LCL comply with an emerging theme standard on windows ?  Cheeky !   Maybe thats me ....

Anyway, the menus are (mostly) just text, I'll reboot into windows and see how things work....

Thanks wp, good advice indeed !

Davo

wp:

--- Quote from: dbannon on June 22, 2019, 01:43:01 pm ---maybe I'd be better to wait until 'someone' makes LCL comply with an emerging theme standard on windows ? 

--- End quote ---
I don't think that this is a fault of the LCL. I just switched my Win 10 to "dark mode" - yes, the system settings form became dark, the explorer too - but that's it, everything else remained bright, Delphi 10.2, Excel, Libre Office, even their NotePad is bright. The Windows dark mode is not complete, it applies only to the new tablet apps but not to standard desktop applications. Wait until Microsoft passes the dark mode settings to the ThemeServices, then the LCL will have it as well automatically.

dbannon:
Yes, I see your reasoning there wp.  But I wonder if its a chicken and egg situation ?

When the windows (.inc) sections of LCL was written, there was no 'theme' available. Nor could they look for the registry entry that indicates you have set the dark theme, it was not, then, defined.

I wonder if System Settings and Explorer look to the registry setting rather than ThemeServices and perhaps Microsoft think thats "job done" ?

I have code in my app that looks at GetRGBColorResolvingParent() color because I do need to manually set some colors, particularly in KControls. Works fine in Linux but under windows that function does not work because, presumably, Windows returns the desktop color ?  and it has not changed. But checking the registry entry is easy -

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   {$ifdef WINDOWS}  function WinDarkTheme : boolean;   var     RegValue : string='';     Registry : TRegistry;   begin     Registry := TRegistry.Create;     try       Registry.RootKey := HKEY_CURRENT_USER;       if Registry.OpenKeyReadOnly('\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize') then           exit(Registry.ReadInteger('AppsUseLightTheme') = 0)       else exit(false);     finally       Registry.Free;     end;   end; {$endif}          

So, my thoughts are that LCL needs to do that during initialization and adjust its colors then. That assumes Microsoft is content to have one dark theme switch and one dark theme.

Something I have noted is that the only thing uglier than a dark theme is a dark theme done badly, and that what I am doing !     :-)

Thanks wp.

Davo

Navigation

[0] Message Index

[*] Previous page

Go to full version