[Solved] Colors of user dialog changes in dark theme

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Jimmy2768
Posts: 19
Joined: Sat Jan 22, 2022 2:15 pm

[Solved] Colors of user dialog changes in dark theme

Post by Jimmy2768 »

Hi to all

I made a dialog and apply to them my prefered colors. If i choose dark theme in operating system some of the colors of the coontrols of the dialog are dark while other remain bright. Is there any way to force the dialog to ignore system's dark theme or high contrast theme in windows and apply the default theme colors?
Or is there any way to check if dark theme is enabled or if some of colors are changed due to dark theme in order to change others color of dialog manualy?

Thanks
Last edited by robleyd on Wed Mar 16, 2022 1:26 am, edited 2 times in total.
Reason: Add green tick
Open Office 4.1.9
MX Linux 19.4 - Windows 7
JeJe
Volunteer
Posts: 2780
Joined: Wed Mar 09, 2016 2:40 pm

Re: Colors of user dialog changes in dark theme

Post by JeJe »

Code: Select all

dialog.getPeer().setProperty( "NativeWidgetLook", False )
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Jimmy2768
Posts: 19
Joined: Sat Jan 22, 2022 2:15 pm

Re: Colors of user dialog changes in dark theme

Post by Jimmy2768 »

Thank you JeJe

I already use this property on my dialog but some regions still changes color in dark theme, like the scroll bar of a Text Field, or the text color of a disabled button, or the text of a treecontrol.
Is there any method to detect the change of the those colors when the dialog run in dark theme in order to change all other control at run time with dark variation of colors?
Open Office 4.1.9
MX Linux 19.4 - Windows 7
JeJe
Volunteer
Posts: 2780
Joined: Wed Mar 09, 2016 2:40 pm

Re: Colors of user dialog changes in dark theme

Post by JeJe »

The colors can be seen with

Code: Select all

.view.stylesettings
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Jimmy2768
Posts: 19
Joined: Sat Jan 22, 2022 2:15 pm

Re: Colors of user dialog changes in dark theme

Post by Jimmy2768 »

Excellent.
Thank you very much JeJe. :D
Open Office 4.1.9
MX Linux 19.4 - Windows 7
Post Reply