B4J Code Snippet Dark theme - base color

SS-2017-07-25_09.56.51.png


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

Active 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

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

Using JavaFX 11:

1718165702593.png


Using JavaFX 23:
1718165683456.png
 

Attachments

  • CSSTest.zip
    3.6 KB · Views: 83
Top