Recent

Author Topic: Can I add a dark theme to my form?  (Read 5354 times)

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: Can I add a dark theme to my form?
« Reply #15 on: April 27, 2022, 03:21:24 pm »
Dark mode can be achieved using Qt5.
Download the unit: https://github.com/doublecmd/doublecmd/blob/master/src/platform/win/udarkstyle.pas
and call it in your application:
Code: Pascal  [Select][+][-]
  1. udarkstyle.ApplyDarkStyle;

You must set the widgetset for your project to qt5
Best regards / Pozdrawiam
paweld

alaa123456789

  • Sr. Member
  • ****
  • Posts: 260
  • Try your Best to learn & help others
    • youtube:
Re: Can I add a dark theme to my form?
« Reply #16 on: April 27, 2022, 08:03:28 pm »
anyone has a tutorial how t use qt5 in Lazarus (video/ text with photos )

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Can I add a dark theme to my form?
« Reply #17 on: April 28, 2022, 01:47:13 am »
In Lazarus ? Trivial, no tutorial needed.
In the project you are working on, Project->ProjectOption->AdditionsAndOverRides(down near bottom)->LCLWidgetType. Add qt5

If your project has several modes, do that for each.

But you will also have to install Qt5 libraries on your Windows box, thats possibly more of a task and one I cannot help with. Your  end user will also need the qt5 libraries by the way.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Can I add a dark theme to my form?
« Reply #18 on: April 28, 2022, 12:57:24 pm »
Just wondering if initialization section is needed for Qt5 ?

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Can I add a dark theme to my form?
« Reply #19 on: April 28, 2022, 01:55:29 pm »
Total guess work, I have never used QT on Windows.

But I can get any colour scheme I like with Qt5 and Linux, with no extra code in the app itself. 

(Obviously, Zeljk knows this but for OP)  An external app, supplied by the QT people themselves (called qt5ct on Linux) sets up colour profiles, you launch your app with an Env Var that tell it, a QT app, which colour profile to use.
Works flawlessly on Linux, never tried it anywhere else.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
Re: Can I add a dark theme to my form?
« Reply #20 on: April 28, 2022, 01:58:41 pm »
Dark theme, dark theme...
Did anyone note that at paweld's picture PageControl is drawn inconsistently with other controls? And black font on dark grey background is almost unreadable?

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Can I add a dark theme to my form?
« Reply #21 on: April 28, 2022, 02:12:52 pm »
Dark theme, dark theme...
Did anyone note that at paweld's picture PageControl is drawn inconsistently with other controls? And black font on dark grey background is almost unreadable?

Hello.

You may also consider the MSEgui widgetset.
It dont need to install any dependencies, works for Windows, Linux, FreeBSD, is 100% Pascal code and you may use dark, light, what-ever-theme you want.

Fre;D
« Last Edit: April 28, 2022, 02:49:40 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Can I add a dark theme to my form?
« Reply #22 on: April 28, 2022, 06:45:36 pm »
You may also consider the MSEgui widgetset.

Hi! Nice to know.
Can you help me to understand the step number 7?

"In 'Project'-'Open' select 'sourcedirectory/apps/demo/demo.prj'."

https://github.com/mse-org/mseide-msegui/#installation

I can't find it.  %)
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Can I add a dark theme to my form?
« Reply #23 on: April 28, 2022, 06:54:39 pm »
You may also consider the MSEgui widgetset.

Hi! Nice to know.
Can you help me to understand the step number 7?

"In 'Project'-'Open' select 'sourcedirectory/apps/demo/demo.prj'."

https://github.com/mse-org/mseide-msegui/#installation

I can't find it.  %)

Hello.

When you have downloaded and unzipped the source (from
https://github.com/mse-org/mseide-msegui/archive/master.zip)

in the directory of your choice (let say "sourcedirectory"), open the project  '/sourcedirectory/apps/demo/demo.prj'.

In my case it is: /home/fred/mseide-msegui/apps/demo/demo.prj

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Can I add a dark theme to my form?
« Reply #24 on: April 28, 2022, 07:15:59 pm »
in the directory of your choice (let say "sourcedirectory"), open the project  '/sourcedirectory/apps/demo/demo.prj'.

B-b-but open with what? How?

Lazarus can't open that file (unless text) and MSEide even.
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Can I add a dark theme to my form?
« Reply #25 on: April 28, 2022, 07:36:42 pm »
I tried to go to:
Project > Options > Tab "Storage", hit the "..." button, and saved it.

Then i Opened it:
Project > Open > 'demo.prj' and run (Continue).

But I'm getting the following error:

"gdb.exe -interpreter=mi -nx"
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Can I add a dark theme to my form?
« Reply #26 on: April 28, 2022, 07:41:20 pm »
in the directory of your choice (let say "sourcedirectory"), open the project  '/sourcedirectory/apps/demo/demo.prj'.

B-b-but open with what? How?

Lazarus can't open that file (unless text) and MSEide even.

With MSEide project files (.prj) are loaded with the menu item "Project" "Open".

Lazarus (afaik) cannot load 'prj' files.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Can I add a dark theme to my form?
« Reply #27 on: April 28, 2022, 07:45:12 pm »
I tried to go to:
Project > Options > Tab "Storage", hit the "..." button, and saved it.

Then i Opened it:
Project > Open > 'demo.prj' and run (Continue).

But I'm getting the following error:

"gdb.exe -interpreter=mi -nx"

Do you have gdb.exe installed on your system?

[EDIT] If gdb.exe is located in a custom path you may adjust it in menu "Settings" "Configure MSEide" "Debugger path".
« Last Edit: April 28, 2022, 08:12:28 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Can I add a dark theme to my form?
« Reply #28 on: April 28, 2022, 08:14:23 pm »
I get it now!
Thank you so much, Fred!
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Can I add a dark theme to my form?
« Reply #29 on: April 28, 2022, 08:15:43 pm »
I get it now!
Thank you so much, Fred!

 ;)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018