Recent

Author Topic: Lazarus Dark mode  (Read 5518 times)

wytwyt02

  • Jr. Member
  • **
  • Posts: 83
Lazarus Dark mode
« on: January 19, 2020, 07:04:13 am »
The macOS and Win10 support dark mode, lazarus only support to change the editor schema, but how to change the entire lazarus ide to dark?

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: Lazarus Dark mode
« Reply #1 on: January 19, 2020, 01:37:45 pm »
The macOS and Win10 support dark mode, lazarus only support to change the editor schema, but how to change the entire lazarus ide to dark?

Only Windows Explorer under Windows 10, and apps made for the store. Also with Electron apps there's an API to detect if the OS is running in dark mode and get the user color, and these are Win32 apps, so it must be possible to do with an app made with Lazarus.

There's an undocumented dll call that changes the theme of the application, but I tried it and didn't work. It applies the look of the Windows Explorer to the app.

On macOS I know is possible changing the manifest, but not everything is fine tuned and of course it requires latest trunk of fpc and lazarus.

xaver13

  • Full Member
  • ***
  • Posts: 111
Re: Lazarus Dark mode
« Reply #2 on: March 24, 2020, 07:24:21 pm »
I have tried so called greyeye theme from devianart https://www.deviantart.com/eversins/art/GreyEveTheme-FINAL-Windows-10-High-Contrast-Theme-643504863

Best result for me was when I changed "ButtonText" to more grey color (120,120,120, was 220,220,220) Lazarus looked quite fine. But I was not satisfied. F.e. outlook and start menu look ugly because of "high contrast" use. Maybe would be better to use another windows theme (not so agressive in dirrection to high contrast). Have you please another experience? Thank you very much for your opinions.
--
Jiri Cvrk

mr-highball

  • Full Member
  • ***
  • Posts: 233
    • Highball Github
Re: Lazarus Dark mode
« Reply #3 on: March 24, 2020, 07:43:24 pm »
there might be better info out there, but looking through msdn and some SO posts, as long as a manifest is included as a resource file that lets the OS know it's built to support styling, the app is linked with a particular lib, and a method is called (either for the entire app, or a particular control) themes would be supported,

(details for lib / method)
https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview?redirectedfrom=MSDN

I haven't tried any of this stuff, just putting it here to maybe help

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Lazarus Dark mode
« Reply #4 on: March 24, 2020, 08:05:30 pm »
Well, but what I am searching for is a kind of notification (e.g. an event) that my app receives to get informed that the theme changed. At least it should be possible to get information if a dark or a light mode is currently active.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Lazarus Dark mode
« Reply #5 on: March 24, 2020, 08:24:04 pm »
In your class's method that reacts to a theme change somewhere set it up as follows:
Code: Pascal  [Select][+][-]
  1. uses Themes;
  2. ...
  3.   ThemeServices.OnThemeChange := @YourThemeChangeHandler;
  4.  
  5. ...

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Lazarus Dark mode
« Reply #6 on: March 24, 2020, 08:44:54 pm »
In your class's method that reacts to a theme change somewhere set it up as follows:
Code: Pascal  [Select][+][-]
  1. uses Themes;
  2. ...
  3.   ThemeServices.OnThemeChange := @YourThemeChangeHandler;
  4.  
  5. ...

Thanks. However, in my handler I should have the means to know if the theme is dark or light. What is the best practice to do this?
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

xaver13

  • Full Member
  • ***
  • Posts: 111
Re: Lazarus Dark mode
« Reply #7 on: March 24, 2020, 08:47:21 pm »
Well, but what I am searching for is a kind of notification (e.g. an event) that my app receives to get informed that the theme changed. At least it should be possible to get information if a dark or a light mode is currently active.

Well, but what I am searching for is a Lazarus dark mode using windows themes. Not my app.
--
Jiri Cvrk

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Lazarus Dark mode
« Reply #8 on: March 24, 2020, 08:53:00 pm »
Well, but what I am searching for is a kind of notification (e.g. an event) that my app receives to get informed that the theme changed. At least it should be possible to get information if a dark or a light mode is currently active.

Well, but what I am searching for is a Lazarus dark mode using windows themes. Not my app.

OK, you are right. The issue with checking the theme should be discussed at https://forum.lazarus.freepascal.org/index.php/topic,48123.msg354271/.

A dark Lazarus would be elegant, of course.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

PizzaProgram

  • Jr. Member
  • **
  • Posts: 53
  • ...developing Delphi apps since 25 years.
Re: Lazarus Dark mode
« Reply #9 on: May 11, 2022, 03:25:19 am »
I've searched for "Lazarus Dark mode" at DuckDuckGo and found this topic as first.

Is there any progress on this?

Can we have a simple "1 click button" on Lazarus IDE to switch between this full-white IDE and a nice dark, Like at NotePad++?
(It is 03:00AM right now and it really hurts my eyes :-( )

Spent  25 minutes to find this + download + restart IDE + set:
  https://wiki.lazarus.freepascal.org/UserSuppliedSchemeSettings
... but that changed only the main coding window. ALL the others are still full white.

It would be nice to make it OS independent, so it would work on Win7 too.
x86_64-win64 --Win7 PRO 64bit HUN

paweld

  • Hero Member
  • *****
  • Posts: 966
Best regards / Pozdrawiam
paweld

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Lazarus Dark mode
« Reply #11 on: May 11, 2022, 08:52:01 am »
It would be nice to make it OS independent, so it would work on Win7 too.

It simply can't be OS independent as Lazarus uses native widgets. If an OS provides no documented way to handle a dark mode (like Windows) then it is simply not possible (using Qt as widgetset on Windows works, because Qt draws the elements itself) or at least not without effort an open source project with a limited developer base can't provide.

 

TinyPortal © 2005-2018