diff --git a/src/main/java/org/jabref/gui/Dark.css b/src/main/java/org/jabref/gui/Dark.css index d87c8ad5e7d..6c92cf74e4e 100644 --- a/src/main/java/org/jabref/gui/Dark.css +++ b/src/main/java/org/jabref/gui/Dark.css @@ -46,12 +46,15 @@ -jr-menu-item-foreground: -fx-light-text-color; -jr-menu-forground-active: derive(-fx-light-text-color, 50%); - -jr-scrollbar-thumb: derive(-fx-outer-border, -30%); + -jr-scrollbar-thumb: -fx-light-text-color; -jr-scrollbar-track: derive(-fx-control-inner-background, -90%); -fx-focused-text-base-color: -fx-dark-text-color; -jr-tooltip-fg: derive(-fx-light-text-color, 50%); + + -jr-drag-target: -jr-accent; + -jr-drag-target-hover: -jr-accent; } #previewBody{ diff --git a/src/main/java/org/jabref/gui/JabRefDialogService.java b/src/main/java/org/jabref/gui/JabRefDialogService.java index e0178808ce2..6c0ccf37611 100644 --- a/src/main/java/org/jabref/gui/JabRefDialogService.java +++ b/src/main/java/org/jabref/gui/JabRefDialogService.java @@ -35,8 +35,10 @@ import org.jabref.gui.icon.IconTheme; import org.jabref.gui.util.DirectoryDialogConfiguration; import org.jabref.gui.util.FileDialogConfiguration; +import org.jabref.gui.util.ThemeLoader; import org.jabref.gui.util.ZipFileChooser; import org.jabref.logic.l10n.Localization; +import org.jabref.preferences.JabRefPreferences; import com.jfoenix.controls.JFXSnackbar; import com.jfoenix.controls.JFXSnackbar.SnackbarEvent; @@ -61,16 +63,22 @@ public class JabRefDialogService implements DialogService { private static final Duration TOAST_MESSAGE_DISPLAY_TIME = Duration.millis(3000); private static final Logger LOGGER = LoggerFactory.getLogger(JabRefDialogService.class); + private static JabRefPreferences preferences; + private static ThemeLoader themeLoader; + private final Window mainWindow; private final JFXSnackbar statusLine; - public JabRefDialogService(Window mainWindow, Pane mainPane) { + public JabRefDialogService(Window mainWindow, Pane mainPane, JabRefPreferences preferences, ThemeLoader themeLoader) { this.mainWindow = mainWindow; this.statusLine = new JFXSnackbar(mainPane); + this.preferences = preferences; + this.themeLoader = themeLoader; } private static FXDialog createDialog(AlertType type, String title, String content) { FXDialog alert = new FXDialog(type, title, true); + themeLoader.installCss(alert.getDialogPane().getScene(), preferences); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -103,7 +111,7 @@ protected Node createDetailsButton() { // Reset the dialog graphic using the default style alert.getDialogPane().setGraphic(graphic); - + themeLoader.installCss(alert.getDialogPane().getScene(), preferences); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -126,6 +134,7 @@ public Optional showChoiceDialogAndWait(String title, String content, Str choiceDialog.setHeaderText(title); choiceDialog.setTitle(title); choiceDialog.setContentText(content); + themeLoader.installCss(choiceDialog.getDialogPane().getScene(), preferences); return choiceDialog.showAndWait(); } @@ -134,6 +143,7 @@ public Optional showInputDialogAndWait(String title, String content) { TextInputDialog inputDialog = new TextInputDialog(); inputDialog.setHeaderText(title); inputDialog.setContentText(content); + themeLoader.installCss(inputDialog.getDialogPane().getScene(), preferences); return inputDialog.showAndWait(); } @@ -142,6 +152,7 @@ public Optional showInputDialogWithDefaultAndWait(String title, String c TextInputDialog inputDialog = new TextInputDialog(defaultValue); inputDialog.setHeaderText(title); inputDialog.setContentText(content); + themeLoader.installCss(inputDialog.getDialogPane().getScene(), preferences); return inputDialog.showAndWait(); } @@ -168,6 +179,7 @@ public void showErrorDialogAndWait(String message, Throwable exception) { ExceptionDialog exceptionDialog = new ExceptionDialog(exception); exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2); exceptionDialog.setHeaderText(message); + themeLoader.installCss(exceptionDialog.getDialogPane().getScene(), preferences); exceptionDialog.showAndWait(); } @@ -176,6 +188,7 @@ public void showErrorDialogAndWait(String title, String content, Throwable excep ExceptionDialog exceptionDialog = new ExceptionDialog(exception); exceptionDialog.setHeaderText(title); exceptionDialog.setContentText(content); + themeLoader.installCss(exceptionDialog.getDialogPane().getScene(), preferences); exceptionDialog.showAndWait(); } @@ -244,6 +257,7 @@ public Optional showCustomDialogAndWait(String title, DialogPane con alert.getButtonTypes().setAll(buttonTypes); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(true); + themeLoader.installCss(alert.getDialogPane().getScene(), preferences); return alert.showAndWait(); } @@ -268,6 +282,7 @@ public void showProgressDialogAndWait(String title, String content, Task task.cancel(); progressDialog.close(); }); + themeLoader.installCss(progressDialog.getDialogPane().getScene(), preferences); progressDialog.show(); } diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 5a122eb28a4..a6ab65e4d4f 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -114,6 +114,7 @@ import org.jabref.gui.undo.UndoRedoAction; import org.jabref.gui.util.BackgroundTask; import org.jabref.gui.util.DefaultTaskExecutor; +import org.jabref.gui.util.ThemeLoader; import org.jabref.logic.autosaveandbackup.AutosaveManager; import org.jabref.logic.autosaveandbackup.BackupManager; import org.jabref.logic.citationstyle.CitationStyleOutputFormat; @@ -152,6 +153,7 @@ public class JabRefFrame extends BorderPane { private final SplitPane splitPane = new SplitPane(); private final JabRefPreferences prefs = Globals.prefs; + private final ThemeLoader themeLoader = Globals.getThemeLoader(); private final GlobalSearchBar globalSearchBar = new GlobalSearchBar(this, Globals.stateManager); private final ProgressBar progressBar = new ProgressBar(); @@ -169,7 +171,7 @@ public class JabRefFrame extends BorderPane { public JabRefFrame(Stage mainStage) { this.mainStage = mainStage; - this.dialogService = new JabRefDialogService(mainStage, this); + this.dialogService = new JabRefDialogService(mainStage, this, prefs, themeLoader); this.stateManager = Globals.stateManager; this.pushToApplicationsManager = new PushToApplicationsManager(dialogService, stateManager); this.undoManager = Globals.undoManager;