Skip to content

Conversation

@SiboVG
Copy link
Member

@SiboVG SiboVG commented Jul 17, 2023

This PR fixes #1089 and implements a dark mode theme to OR using the Darklaf library (which looks a bit better than the FlatLaf dark mode theme). Additionally, you can also change the UI font size in the preferences.

I'm gonna mark this as a draft for now, because there is a bug on Windows and Linux where Darklaf throws an exception when running on Java 17 (and maybe also Java 11?). I've filed a bug report for it here. I may try to fix the darklaf source code to fix this issue, we'll see. But, I already want to put this PR up so people can test it (looking at you @neilweinstock, please be gentle on me 😉). Remember that it will take some time to get used to the new look, so please get used to the theme and then write your remarks.

For Windows and Linux, you should run the JAR with java -jar --add-exports java.desktop/sun.awt=ALL-UNNAMED OpenRocket.jar. This bypasses the Darklaf bug I talked about earlier.

Here are some screenshots of the new dark look:
Screenshot 2023-07-17 at 13 24 29
Screenshot 2023-07-17 at 13 25 00
Screenshot 2023-07-17 at 13 25 17
Screenshot 2023-07-17 at 13 25 36
Screenshot 2023-07-17 at 13 26 35
Screenshot 2023-07-17 at 13 26 47
Screenshot 2023-07-17 at 13 27 02

I also increased the ambient light in the 3D finished view (a request @neilweinstock also made some time ago):
Screenshot 2023-07-17 at 13 27 21

Here, the UI font size is increased from 13 pt to 15 pt:
Screenshot 2023-07-17 at 13 29 08

Note, Darklaf uses a different color chooser than what you're used to in the light theme. This is just because of how the library is built, nothing I can do about it really. But it still has all the same functions as the light theme color chooser.
Screenshot 2023-07-17 at 13 26 18
Screenshot 2023-07-17 at 13 26 22


I also fixed the issue where the UI looked horrible on some Linux builds because it would apply its own dark theme.

How it looked before:
Screenshot 2023-07-17 at 13 31 20

How it looks now:
Screenshot 2023-07-17 at 13 31 41

SiboVG added 10 commits June 29, 2023 22:12
This method works also for dark mode
# Conflicts:
#	swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java
#	swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java
This is from a custom build of darklaf where I removed the 20 offset from shadowSize (see weisJ/darklaf#347)
@neilweinstock
Copy link
Contributor

I will test it for myself as soon as the build passes.

I am not a dark mode aficionado but the screenshots look reasonable (not what I would want to ever use, though). Maybe the text is a bit too grey, could be brighter? Seems to be a bit less contrast overall than I would want to see, but maybe that's how dark mode generally looks, dunno.

@SiboVG SiboVG marked this pull request as draft July 17, 2023 12:06
@SiboVG
Copy link
Member Author

SiboVG commented Jul 17, 2023

Here is a JAR file for testing. Build is failing because of reasons I don't want to solve right now 🙃. Troubles for future Sibo...

@SiboVG
Copy link
Member Author

SiboVG commented Jul 17, 2023

I am not a dark mode aficionado but the screenshots look reasonable (not what I would want to ever use, though). Maybe the text is a bit too grey, could be brighter? Seems to be a bit less contrast overall than I would want to see, but maybe that's how dark mode generally looks, dunno.

I'm an avid dark mode user, it's not unusual for the contrast to be like this. I could adjust it if need be, but it's a pretty standard dark mode look.

@neilweinstock
Copy link
Contributor

I am not a dark mode aficionado but the screenshots look reasonable (not what I would want to ever use, though). Maybe the text is a bit too grey, could be brighter? Seems to be a bit less contrast overall than I would want to see, but maybe that's how dark mode generally looks, dunno.

I'm an avid dark mode user, it's not unusual for the contrast to be like this. I could adjust it if need be, but it's a pretty standard dark mode look.

In that case I defer to your judgment. I'll give the JAR file a whirl when I get a chance.

@neilweinstock
Copy link
Contributor

Tried it out on Java 17 on my Mac (running OS13.2.1). Looked like your screenshots. :) The fades on the left and right edges of the component icons don't look great in dark mode, but probably not worth messing with.

When I clicked on the pulldown to switch to "3D finished" view, I got an exception.

@SiboVG
Copy link
Member Author

SiboVG commented Jul 18, 2023

java -jar --add-exports java.desktop/sun.awt=ALL-UNNAMED

Does the exception go away when you run the JAR with java -jar --add-exports java.desktop/sun.awt=ALL-UNNAMED OpenRocket.jar?

@SiboVG SiboVG marked this pull request as ready for review July 29, 2023 01:42
@SiboVG
Copy link
Member Author

SiboVG commented Jul 29, 2023

Okay, I added a hotfix for the Java 17 issue and compiled darklaf myself (see my branch). So, the dark mode should run fine now. I've tested it on my macOS machine an Parallels Desktop versions of Windows and Linux, but I'd very much like a quick test from @JoePfeiffer, @hcraigmiller and @neilweinstock to verify that it works.

@JoePfeiffer
Copy link
Contributor

Currently out of town at NARAM -- I should be able to look at it Wednesday or Thursday.

@SiboVG
Copy link
Member Author

SiboVG commented Jul 29, 2023

Currently out of town at NARAM -- I should be able to look at it Wednesday or Thursday.

Even better, then you can let the rocketeers there test it 😉. Good luck and have fun!

@SiboVG
Copy link
Member Author

SiboVG commented Aug 8, 2023

@neilweinstock @JoePfeiffer could you run a quick test on this to see whether nothing crashes?

@neilweinstock
Copy link
Contributor

Quick test here worked fine.

I note that many of the component icons don't look great in dark mode, but I think we can address that later if desired.

@JoePfeiffer
Copy link
Contributor

Looks good to me; no issues when I tried it. It's unfortunate that a restart is required to see the changes, but I expect that's a limitation you can't do anything about.

Any particular reason for the max/min font sizes? I expect that especially allowing larger ones would assist people with vision problems.

I agree with @neilweinstock that we should go ahead and do this, and worry about improving the icons for dark mode later if at all.

@SiboVG
Copy link
Member Author

SiboVG commented Aug 8, 2023

It's unfortunate that a restart is required to see the changes, but I expect that's a limitation you can't do anything about.

Yup. It's technically possible, but extremely tricky in our situation since we have a rather complex UI with components all over the place. Not something I want to attempt to fix...

Any particular reason for the max/min font sizes? I expect that especially allowing larger ones would assist people with vision problems.

I increased the range a bit. I just don't want users to not know how the sizing works and enter a huge number such as 100, resulting in completely unusable UI in which they can't even reset their UI font size to a normal level.

@SiboVG SiboVG merged commit e2993a6 into openrocket:unstable Aug 8, 2023
@SiboVG SiboVG deleted the dark-theme branch August 8, 2023 23:56
@bobjacobsen bobjacobsen mentioned this pull request Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Dark Mode

3 participants