Skip to content

Commit 26a710a

Browse files
committed
Allow users to define a custom CSS file that can override defaults
Allows users to override the 'not_enabled' styling as well as others used by Phoebus. Introduces a new property that can be set to the path of the CSS file.
1 parent 933d2a2 commit 26a710a

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

core/ui/src/main/java/org/phoebus/ui/Preferences.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public class Preferences
9595
@Preference public static boolean save_credentials;
9696
/** documentation_location */
9797
@Preference public static String documentation_location;
98+
/** Custom stylings file */
99+
@Preference public static String custom_css_styling;
98100

99101
static
100102
{

core/ui/src/main/java/org/phoebus/ui/javafx/Styles.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
******************************************************************************/
88
package org.phoebus.ui.javafx;
99

10+
import org.phoebus.ui.Preferences;
11+
1012
import javafx.scene.Node;
1113
import javafx.scene.Scene;
1214

@@ -24,6 +26,10 @@ public static void setSceneStyle(final Scene scene)
2426
{
2527
final String css = Styles.class.getResource("csstudio.css").toExternalForm();
2628
set(scene, css);
29+
if (!Preferences.custom_css_styling.isEmpty())
30+
{
31+
set(scene, Preferences.custom_css_styling);
32+
}
2733
}
2834

2935
/** Apply style sheet to scene (but only once)

core/ui/src/main/resources/phoebus_ui_preferences.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,9 @@ save_credentials=false
179179

180180
# Location of the Phoebus documentation
181181
documentation_location=
182+
183+
# Custom stylings .css file allows users to override Phoebus and JavaFX
184+
# default stylings.Set the full path to the .css file
185+
# For a system file use syntax; 'file:</path/to/custom.css>'
186+
# For a file served over http use syntax: 'http://<address:port/custom.css>'
187+
custom_css_styling=

0 commit comments

Comments
 (0)