From e485b28595d1d2021627a458ce37e589bed90b03 Mon Sep 17 00:00:00 2001 From: Florian Enner Date: Sun, 11 Dec 2022 05:46:50 +0100 Subject: [PATCH] Add SceneBuilder theme pack generation (#28) --- README.md | 17 ++++++++++++++++ styles/pom.xml | 27 +++++++++++++++++++------ styles/scenebuilder.xml | 45 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 styles/scenebuilder.xml diff --git a/README.md b/README.md index f5f94fa..c1d8c6f 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,23 @@ Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet()); Check the [docs](https://mkpaz.github.io/atlantafx/) for more information. +## SceneBuilder Integration + +While SceneBuilder does not support adding custom themes, it is possible to overwrite looked up css paths to make the existing buttons load custom css files. In order to use AtlantaFX in SceneBuilder you need to + +1. run `mvn package -pl styles` to generate theme css files with the correct path names +2. copy `styles/target/AtlantaFX-${version}-scenebuilder.zip` to the SceneBuilder `$APPDIR` (e.g. `%HOMEPATH%/Local/SceneBuilder/app/` on Windows) or another directory of your choice +3. open `SceneBuilder.cfg` in the SceneBuilder app directory and add the zip file to the beginning of the `app.classpath` variable (e.g. `app.classpath=$APPDIR\AtlantaFX-${version}-scenebuilder.zip;$APPDIR\scenebuilder-18.0.0-all.jar` on Windows) + +After restarting SceneBuilder you can now select AtlantaFX themes in the menu `Preview -> Themes -> Caspian Embedded (FX2)`. The themes are mapped as follows + +| SceneBuilder | Modifier | AtlantaFX Theme | +|-----------------------------|-----------------------------|-----------------| +| Caspian Embedded (FX2) | None | Primer Light | +| Caspian Embedded (FX2) | Caspian High Contrast (FX2) | Primer Dark | +| Caspian Embedded QVGA (FX2) | None | Nord Light | +| Caspian Embedded QVGA (FX2) | Caspian High Contrast (FX2) | Nord Dark | + ## Contributing Contributions are always welcome! Contributing can mean many things such as participating in discussion or proposing changes. Feel free to open an issue if you've found a bug or want to raise a question, or discuss a possible feature. diff --git a/styles/pom.xml b/styles/pom.xml index e3b8849..11f13c2 100755 --- a/styles/pom.xml +++ b/styles/pom.xml @@ -53,24 +53,39 @@ org.apache.maven.plugins maven-assembly-plugin + + ${project.build.directory} + false + false + posix + - assembly - install + assemble-themes + package single - ${project.build.directory} ${app.name}-${app.version}-themes - false - false - posix assembly.xml + + assemble-scenebuilder + package + + single + + + ${app.name}-${app.version}-scenebuilder + + scenebuilder.xml + + + diff --git a/styles/scenebuilder.xml b/styles/scenebuilder.xml new file mode 100644 index 0000000..593ef64 --- /dev/null +++ b/styles/scenebuilder.xml @@ -0,0 +1,45 @@ + + + + assembly + + zip + + false + + + + + /com/oracle/javafx/scenebuilder/kit/util/css/caspian + dist/ + false + + + + + + + /com/oracle/javafx/scenebuilder/kit/util/css/caspian + dist/primer-light.css + caspian-embedded.css + + + /com/oracle/javafx/scenebuilder/kit/util/css/caspian + dist/primer-dark.css + caspian-embedded-highContrast.css + + + /com/oracle/javafx/scenebuilder/kit/util/css/caspian + dist/nord-light.css + caspian-embedded-qvga.css + + + /com/oracle/javafx/scenebuilder/kit/util/css/caspian + dist/nord-dark.css + caspian-embedded-qvga-highContrast.css + + + +