Dark Mode

This topic has been viewed 46968 times and has 34 replies
Thread status: Active
Features you would like to see [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
shadowcaster
Posts: 3
Joined: Wed Jun 05, 2024 7:13 am
Country: United States

Re: Dark Mode

Post by shadowcaster »

Hello Daniels,

Thanks for replying. I tried running those commands, but the result is still the same.

This was the initial result:

Code: Select all

PS C:\Program Files\Sweet Home 3D\lib> set SH3DINST="C:\Program Files\Sweet Home 3D"
PS C:\Program Files\Sweet Home 3D\lib> "%SH3DINST%\runtime\bin\javaw.exe" -Dswing.defaultlaf=com.formdev.flatlaf.FlatDarkLaf "-Djava.library.path=%SH3DINST%\lib\java3d-1.6\;%SH3DINST%\lib\yafaray;%SH3DINST%\lib\yafaray\yafaray-plugins" -classpath "%SH3DINST%\lib\java3d-1.6\*;%SH3DINST%\lib\*" com.eteks.sweethome3d.SweetHome3D
At line:1 char:36
+ "%SH3DINST%\runtime\bin\javaw.exe" -Dswing.defaultlaf=com.formdev.fla ...
+                                    ~~~~~~~
Unexpected token '-Dswing' in expression or statement.
At line:1 char:43
+ ... javaw.exe" -Dswing.defaultlaf=com.formdev.flatlaf.FlatDarkLaf "-Djava ...
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '.defaultlaf=com.formdev.flatlaf.FlatDarkLaf' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
However, with some chatgpt help I ended up with:

Code: Select all

PS C:\Program Files\Sweet Home 3D\lib> $env:SH3DINST="C:\Program Files\Sweet Home 3D"
PS C:\Program Files\Sweet Home 3D\lib> & "$env:SH3DINST\runtime\bin\javaw.exe" -Dswing.defaultlaf=com.formdev.flatlaf.FlatDarkLaf "-Djava.library.path=$env:SH3DINST\lib\java3d-1.6;$env:SH3DINST\lib\yafaray;$env:SH3DINST\lib\yafaray\yafaray-plugins" -classpath "$env:SH3DINST\lib\java3d-1.6\*;$env:SH3DINST\lib\*" com.eteks.sweethome3d.SweetHome3D
PS C:\Program Files\Sweet Home 3D\lib>


I tried running this from both inside the sweet home 3d\lib folder and just from C:\. Either way, the end result was running the java -jar command with -dswing again but still not seeing any changes.


I did come across another post regarding changing resolution that stated to add an ini file with:

Code: Select all

-Dcom.eteks.sweethome3d.resolutionScale=1.5
-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
-Dswing.plaf.metal.controlFont=Dialog-11
-Dswing.plaf.metal.userFont=SansSerif-11
-Dswing.plaf.metal.systemFont=SansSerif-11


and this did work to change the LAF. However, I couldn't figure out how to make flatlaf work in this same way. Note that I did test the above code without this ini file in the sweet home folder to ensure there wasn't a conflict.
User avatar
Daniels118
Posts: 503
Joined: Wed Nov 17, 2021 9:04 pm
Country: Italy

Re: Dark Mode

Post by Daniels118 »

Please retry my commands from a normal cmd, not powershell.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Dark Mode

Post by Puybaret »

Maybe you should use quotes also around [font=courier new]"-Dswing.defaultlaf=com.formdev.flatlaf.FlatDarkLaf"[/font]
Emmanuel Puybaret, Sweet Home 3D creator
shadowcaster
Posts: 3
Joined: Wed Jun 05, 2024 7:13 am
Country: United States

Re: Dark Mode

Post by shadowcaster »

Thank you Daniels! I had tried cmd yesterday but got an error. I see now it was because I added quotes around the file path in the set command thinking it wouldn't properly read the spaces.

Thanks so much for the help! My eyes will be forever grateful :)
User avatar
byDMA
Posts: 26
Joined: Sat Jun 08, 2024 7:29 pm
Country: GERMANY | POLAND

Re: Dark Mode

Post by byDMA »

Thank you for the information about the flatlaf. I have now implemented it and adapted many things. It looks like KDE. Really great! But dark-mode is not all you need. You still need icons for the dark interface, otherwise you won't see ANYTHING if the icons are dark. And this is often the case. This is exactly how you need to prepare the icons for plugins. I have done all this and it really looks "round". However, I still have a problem: The icons from the plugins are ALWAYS scaled with 16 pixels in the menus, although I have generated them from vector graphics with 32 pixels. In dialogs of plugins, other icons are displayed correctly and in a large size. Does anyone have any idea what it could be?
If someone wants, I can send the icons and flatlaf properties.

https://disk.yandex.com/d/SVPgWiB7ORwsSQ
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Dark Mode

Post by Puybaret »

Very nice work byDMA! And you even prepared a new icon set! The existing ones in reverse video didn't please you? Anyway, I hope at least that the SVG existing ones helped you to prepare the new set faster.
It could be possible that 32x32 icons in plug-ins are ignored because they are accessed from plug-in class loader, and FlatLaf needs more information to find it (this would probably require some modifications in Sweet Home 3D or FlatLaf source code).
Emmanuel Puybaret, Sweet Home 3D creator
User avatar
byDMA
Posts: 26
Joined: Sat Jun 08, 2024 7:29 pm
Country: GERMANY | POLAND

Re: Dark Mode

Post by byDMA »

Hi Emmanuel, thanks for the quick response and for the praise.
The existing ones in reverse video didn't please you?
Which video do you mean?


I've done some more tests and found out the following:
-This has nothing to do with Flatlaf, this is also the case in the old Steel design
- It ONLY works if scaling factor is 2, between 1 and 2 this does not change
- Scaling is really a bad idea at Latlaf, everything is going to be huge

Latlaf (out-the-box) is actually an ideal interface for SH3D, everything is scaled and designed correctly - except for the icons from the plugins :-)

Take a look at this:
https://disk.yandex.com/d/-qCRHNEioo8tbA

I suspect this is the JFrame in the menu(s) for the plugins in SH3D. It frames the icons up to the scaling factor 2. Only then it gets bigger and the icons are enlarged.

Could you check it out? This should not be a big problem. Then the design would be perfect.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Dark Mode

Post by Puybaret »

By "reverse video", I meant "opposite colors" : white becomes black and black becomes white. The icons proposed in version 6.6 were designed for this purpose.
Emmanuel Puybaret, Sweet Home 3D creator
User avatar
byDMA
Posts: 26
Joined: Sat Jun 08, 2024 7:29 pm
Country: GERMANY | POLAND

Re: Dark Mode

Post by byDMA »

The icons proposed in version 6.6 were designed for this purpose.
Do you mean this?
https://m3.material.io/styles/icons/designing-icons

"De gustibus non est disputandum" :-)
Its GTK 20 years ago, but seriously, the users are coming from mac, windows AND linux, and it should be customizable.

It would be best if you could use the icons as SVG files. I know this from JDownloader. Maybe you can take the code quickly?
https://support.jdownloader.org/de/know ... de-eclipse
white becomes black and black becomes white.
That's how I did it too. With Flatlaf Dark and Light this works in both directions.

But I am interested in the topic for the plugins-icons and jframe for these icons.
User avatar
byDMA
Posts: 26
Joined: Sat Jun 08, 2024 7:29 pm
Country: GERMANY | POLAND

Re: Dark Mode

Post by byDMA »

I think this is the place where the icons for menus and the toolbar are scaled compulsorily. Why? I suspect because this is an "unknown" source.

ResourceAction.java[/code]

https://sourceforge.net/p/sweethome3d/c ... .java#l130

Code: Select all

  String smallIcon = getOptionalString(preferences, resourceClass, propertyPrefix + SMALL_ICON, false);
    if (smallIcon != null) {
      putValue(SMALL_ICON, SwingTools.getScaledImageIcon(resourceClass.getResource(smallIcon)));
    }

    String toolBarIcon = getOptionalString(preferences, resourceClass, propertyPrefix + TOOL_BAR_ICON, false);
    if (toolBarIcon != null) {
      putValue(TOOL_BAR_ICON, SwingTools.getScaledImageIcon(resourceClass.getResource(toolBarIcon)));
    }
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest