B4J Code Snippet Dark theme - base color



1. Create a file named dark.css with this text in the Files folder:
B4X:
.root {
  -fx-base: rgba(60, 63, 65, 255); // dark
}

2. Load it with:
B4X:
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "dark.css"))

That's it.

Based on this blog: http://dlsc.com/2017/07/03/javafx-tip-26/
 

xulihang

Well-Known Member
Licensed User
Longtime User
How to avoid a control from being affected by this style. Some controls are not expected to be dark themed like text. I want to keep the text color.

The text color being affected only happens in JavaFX 23.
 

aeric

Expert
Licensed User
Longtime User
How to avoid a control from being affected by this style. Some controls are not expected to be dark themed like text. I want to keep the text color.

The text color being affected only happens in JavaFX 23.
You should post your question in a new thread.
You can use same text color for both dark and light theme.
 

xulihang

Well-Known Member
Licensed User
Longtime User
I think posting here is better as all the users can know this problem.

Using JavaFX 11:



Using JavaFX 23:
 

Attachments

  • CSSTest.zip
    3.6 KB · Views: 219
Cookies are required to use this site. You must accept them to continue using the site. Learn more…