diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f4c1efa05f..c71d7449bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Added - We added a query parser and mapping layer to enable conversion of queries formulated in simplified lucene syntax by the user into api queries. [#6799](https://github.com/JabRef/jabref/pull/6799) +- We added some basic functionality to customise the look of JabRef by importing a css theme file. [#5790](https://github.com/JabRef/jabref/issues/5790) ### Changed diff --git a/src/main/java/org/jabref/Globals.java b/src/main/java/org/jabref/Globals.java index a03fbfc5ac9..8663a282b13 100644 --- a/src/main/java/org/jabref/Globals.java +++ b/src/main/java/org/jabref/Globals.java @@ -13,7 +13,6 @@ import org.jabref.gui.util.DefaultFileUpdateMonitor; import org.jabref.gui.util.DefaultTaskExecutor; import org.jabref.gui.util.TaskExecutor; -import org.jabref.gui.util.ThemeLoader; import org.jabref.logic.exporter.ExporterFactory; import org.jabref.logic.importer.ImportFormatReader; import org.jabref.logic.journals.JournalAbbreviationRepository; @@ -80,7 +79,6 @@ public class Globals { private static KeyBindingRepository keyBindingRepository; private static DefaultFileUpdateMonitor fileUpdateMonitor; - private static ThemeLoader themeLoader; private static TelemetryClient telemetryClient; private Globals() { @@ -95,12 +93,10 @@ public static synchronized KeyBindingRepository getKeyPrefs() { } // Background tasks - public static void startBackgroundTasks() throws JabRefException { + public static void startBackgroundTasks() { Globals.fileUpdateMonitor = new DefaultFileUpdateMonitor(); JabRefExecutorService.INSTANCE.executeInterruptableTask(Globals.fileUpdateMonitor, "FileUpdateMonitor"); - themeLoader = new ThemeLoader(fileUpdateMonitor, prefs); - if (Globals.prefs.shouldCollectTelemetry() && !GraphicsEnvironment.isHeadless()) { startTelemetryClient(); } @@ -146,8 +142,4 @@ public static void stopBackgroundTasks() { public static Optional getTelemetryClient() { return Optional.ofNullable(telemetryClient); } - - public static ThemeLoader getThemeLoader() { - return themeLoader; - } } diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index 721f6a686fd..fd228609a3d 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -48,6 +48,7 @@ public JabRefGUI(Stage mainStage, List databases, boolean isBlank) this.bibDatabases = databases; this.isBlank = isBlank; this.correctedWindowPos = false; + mainFrame = new JabRefFrame(mainStage); openWindow(mainStage); @@ -86,7 +87,7 @@ private void openWindow(Stage mainStage) { root.getChildren().add(JabRefGUI.mainFrame); Scene scene = new Scene(root, 800, 800); - Globals.getThemeLoader().installCss(scene, Globals.prefs); + Globals.prefs.getTheme().installCss(scene); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); diff --git a/src/main/java/org/jabref/gui/JabRefDialogService.java b/src/main/java/org/jabref/gui/JabRefDialogService.java index 0f45d987b09..292486b146a 100644 --- a/src/main/java/org/jabref/gui/JabRefDialogService.java +++ b/src/main/java/org/jabref/gui/JabRefDialogService.java @@ -38,7 +38,6 @@ import org.jabref.gui.util.BackgroundTask; 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; @@ -69,21 +68,19 @@ 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, JabRefPreferences preferences, ThemeLoader themeLoader) { + public JabRefDialogService(Window mainWindow, Pane mainPane, JabRefPreferences preferences) { this.mainWindow = mainWindow; this.statusLine = new JFXSnackbar(mainPane); JabRefDialogService.preferences = preferences; - JabRefDialogService.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); + preferences.getTheme().installCss(alert.getDialogPane().getScene()); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -116,7 +113,7 @@ protected Node createDetailsButton() { // Reset the dialog graphic using the default style alert.getDialogPane().setGraphic(graphic); - themeLoader.installCss(alert.getDialogPane().getScene(), preferences); + preferences.getTheme().installCss(alert.getDialogPane().getScene()); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -139,7 +136,7 @@ public Optional showChoiceDialogAndWait(String title, String content, Str choiceDialog.setHeaderText(title); choiceDialog.setTitle(title); choiceDialog.setContentText(content); - themeLoader.installCss(choiceDialog.getDialogPane().getScene(), preferences); + preferences.getTheme().installCss(choiceDialog.getDialogPane().getScene()); return choiceDialog.showAndWait(); } @@ -148,7 +145,7 @@ public Optional showInputDialogAndWait(String title, String content) { TextInputDialog inputDialog = new TextInputDialog(); inputDialog.setHeaderText(title); inputDialog.setContentText(content); - themeLoader.installCss(inputDialog.getDialogPane().getScene(), preferences); + preferences.getTheme().installCss(inputDialog.getDialogPane().getScene()); return inputDialog.showAndWait(); } @@ -157,7 +154,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); + preferences.getTheme().installCss(inputDialog.getDialogPane().getScene()); return inputDialog.showAndWait(); } @@ -184,7 +181,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); + preferences.getTheme().installCss(exceptionDialog.getDialogPane().getScene()); exceptionDialog.showAndWait(); } @@ -193,7 +190,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); + preferences.getTheme().installCss(exceptionDialog.getDialogPane().getScene()); exceptionDialog.showAndWait(); } @@ -262,7 +259,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); + preferences.getTheme().installCss(alert.getDialogPane().getScene()); return alert.showAndWait(); } @@ -287,7 +284,7 @@ public void showProgressDialog(String title, String content, Task task) { task.cancel(); progressDialog.close(); }); - themeLoader.installCss(progressDialog.getDialogPane().getScene(), preferences); + preferences.getTheme().installCss(progressDialog.getDialogPane().getScene()); progressDialog.show(); } @@ -310,7 +307,7 @@ public Optional showBackgroundProgressDialogAndWait(String title alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.CANCEL); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(true); - themeLoader.installCss(alert.getDialogPane().getScene(), preferences); + preferences.getTheme().installCss(alert.getDialogPane().getScene()); stateManager.getAnyTaskRunning().addListener((observable, oldValue, newValue) -> { if (!newValue) { @@ -319,7 +316,7 @@ public Optional showBackgroundProgressDialogAndWait(String title } }); - Dialog dialog = () -> alert.showAndWait(); + Dialog dialog = alert::showAndWait; return showCustomDialogAndWait(dialog); } diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 28204b87a42..a7590558a1c 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -121,7 +121,6 @@ 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; @@ -162,7 +161,6 @@ 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, prefs); private final FileHistoryMenu fileHistory; @@ -180,7 +178,7 @@ public class JabRefFrame extends BorderPane { public JabRefFrame(Stage mainStage) { this.mainStage = mainStage; - this.dialogService = new JabRefDialogService(mainStage, this, prefs, themeLoader); + this.dialogService = new JabRefDialogService(mainStage, this, prefs); this.stateManager = Globals.stateManager; this.pushToApplicationsManager = new PushToApplicationsManager(dialogService, stateManager, prefs); this.undoManager = Globals.undoManager; diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml b/src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml index 2eb988a44e2..e2f57285195 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml @@ -1,13 +1,19 @@ + + + + + + @@ -28,4 +34,18 @@ diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java b/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java index 1d97c4e0acf..21dd8c94bf1 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTabView.java @@ -6,6 +6,7 @@ import javafx.scene.control.CheckBox; import javafx.scene.control.RadioButton; import javafx.scene.control.Spinner; +import javafx.scene.control.TextField; import org.jabref.gui.util.IconValidationDecorator; import org.jabref.logic.l10n.Localization; @@ -20,6 +21,8 @@ public class AppearanceTabView extends AbstractPreferenceTabView fontSize; @FXML public RadioButton themeLight; @FXML public RadioButton themeDark; + @FXML public RadioButton customTheme; + @FXML public TextField customThemePath; private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer(); @@ -49,8 +52,18 @@ public void initialize() { themeLight.selectedProperty().bindBidirectional(viewModel.themeLightProperty()); themeDark.selectedProperty().bindBidirectional(viewModel.themeDarkProperty()); + customTheme.selectedProperty().bindBidirectional(viewModel.customThemeProperty()); + customThemePath.textProperty().bindBidirectional(viewModel.customPathToThemeProperty()); validationVisualizer.setDecoration(new IconValidationDecorator()); - Platform.runLater(() -> validationVisualizer.initVisualization(viewModel.fontSizeValidationStatus(), fontSize)); + Platform.runLater(() -> { + validationVisualizer.initVisualization(viewModel.fontSizeValidationStatus(), fontSize); + validationVisualizer.initVisualization(viewModel.customPathToThemeValidationStatus(), customThemePath); + }); + } + + @FXML + void importTheme() { + viewModel.importCSSFile(); } } diff --git a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java index 6602791e261..b2f3e1638b0 100644 --- a/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/AppearanceTabViewModel.java @@ -10,10 +10,15 @@ import javafx.scene.control.SpinnerValueFactory; import org.jabref.gui.DialogService; -import org.jabref.gui.util.ThemeLoader; +import org.jabref.gui.util.FileDialogConfiguration; +import org.jabref.gui.util.Theme; import org.jabref.logic.l10n.Localization; -import org.jabref.preferences.JabRefPreferences; +import org.jabref.logic.util.StandardFileType; +import org.jabref.model.strings.StringUtil; +import org.jabref.preferences.AppearancePreferences; +import org.jabref.preferences.PreferencesService; +import de.saxsys.mvvmfx.utils.validation.CompositeValidator; import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator; import de.saxsys.mvvmfx.utils.validation.ValidationMessage; import de.saxsys.mvvmfx.utils.validation.ValidationStatus; @@ -24,21 +29,28 @@ public class AppearanceTabViewModel implements PreferenceTabViewModel { public static SpinnerValueFactory fontSizeValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(9, Integer.MAX_VALUE); + private static final String EMBEDDED_DARK_THEME_CSS = "Dark.css"; + private final BooleanProperty fontOverrideProperty = new SimpleBooleanProperty(); private final StringProperty fontSizeProperty = new SimpleStringProperty(); private final BooleanProperty themeLightProperty = new SimpleBooleanProperty(); private final BooleanProperty themeDarkProperty = new SimpleBooleanProperty(); + private final BooleanProperty themeCustomProperty = new SimpleBooleanProperty(); + private final StringProperty customPathToThemeProperty = new SimpleStringProperty(); private final DialogService dialogService; - private final JabRefPreferences preferences; + private final PreferencesService preferences; + private final AppearancePreferences initialAppearancePreferences; - private Validator fontSizeValidator; + private final Validator fontSizeValidator; + private final Validator customPathToThemeValidator; - private List restartWarnings = new ArrayList<>(); + private final List restartWarnings = new ArrayList<>(); - public AppearanceTabViewModel(DialogService dialogService, JabRefPreferences preferences) { + public AppearanceTabViewModel(DialogService dialogService, PreferencesService preferences) { this.dialogService = dialogService; this.preferences = preferences; + this.initialAppearancePreferences = preferences.getAppearancePreferences(); fontSizeValidator = new FunctionBasedValidator<>( fontSizeProperty, @@ -53,55 +65,96 @@ public AppearanceTabViewModel(DialogService dialogService, JabRefPreferences pre Localization.lang("Appearance"), Localization.lang("Font settings"), Localization.lang("You must enter an integer value higher than 8.")))); + + customPathToThemeValidator = new FunctionBasedValidator<>( + customPathToThemeProperty, + input -> !StringUtil.isNullOrEmpty(input), + ValidationMessage.error(String.format("%s > %s %n %n %s", + Localization.lang("Appearance"), + Localization.lang("Visual theme"), + Localization.lang("Please specify a css theme file.")))); } @Override public void setValues() { - fontOverrideProperty.setValue(preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE)); - fontSizeProperty.setValue(String.valueOf(preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE))); - - switch (preferences.get(JabRefPreferences.FX_THEME)) { - case ThemeLoader.DARK_CSS: - themeLightProperty.setValue(false); - themeDarkProperty.setValue(true); - break; - case ThemeLoader.MAIN_CSS: - default: - themeLightProperty.setValue(true); - themeDarkProperty.setValue(false); + fontOverrideProperty.setValue(initialAppearancePreferences.shouldOverrideDefaultFontSize()); + fontSizeProperty.setValue(String.valueOf(initialAppearancePreferences.getMainFontSize())); + + Theme currentTheme = initialAppearancePreferences.getTheme(); + if (currentTheme.getType() == Theme.Type.LIGHT) { + themeLightProperty.setValue(true); + themeDarkProperty.setValue(false); + themeCustomProperty.setValue(false); + } else if (currentTheme.getType() == Theme.Type.DARK) { + themeLightProperty.setValue(false); + themeDarkProperty.setValue(true); + themeCustomProperty.setValue(false); + } else { + themeLightProperty.setValue(false); + themeDarkProperty.setValue(false); + themeCustomProperty.setValue(true); + customPathToThemeProperty.setValue(currentTheme.getPath().toString()); } } @Override public void storeSettings() { - if (preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE) != fontOverrideProperty.getValue()) { + if (initialAppearancePreferences.shouldOverrideDefaultFontSize() != fontOverrideProperty.getValue()) { restartWarnings.add(Localization.lang("Override font settings")); - preferences.putBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE, fontOverrideProperty.getValue()); } int newFontSize = Integer.parseInt(fontSizeProperty.getValue()); - if (preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE) != newFontSize) { + if (initialAppearancePreferences.getMainFontSize() != newFontSize) { restartWarnings.add(Localization.lang("Override font size")); - preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, newFontSize); } - if (themeLightProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.MAIN_CSS)) { + Theme newTheme = initialAppearancePreferences.getTheme(); + if (themeLightProperty.getValue() && initialAppearancePreferences.getTheme().getType() != Theme.Type.LIGHT) { restartWarnings.add(Localization.lang("Theme changed to light theme.")); - preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.MAIN_CSS); - } else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) { + newTheme = new Theme("", preferences); + } else if (themeDarkProperty.getValue() && initialAppearancePreferences.getTheme().getType() != Theme.Type.DARK) { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); - preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); + newTheme = new Theme(EMBEDDED_DARK_THEME_CSS, preferences); + } else if (themeCustomProperty.getValue() && + (!initialAppearancePreferences.getTheme().getPath().toString() + .equalsIgnoreCase(customPathToThemeProperty.getValue()) + || initialAppearancePreferences.getTheme().getType() != Theme.Type.CUSTOM)) { + restartWarnings.add(Localization.lang("Theme changed to a custom theme:") + " " + + customPathToThemeProperty().getValue()); + newTheme = new Theme(customPathToThemeProperty.getValue(), preferences); } + + preferences.storeAppearancePreference(new AppearancePreferences( + fontOverrideProperty.getValue(), + newFontSize, + newTheme)); + + preferences.updateTheme(); } public ValidationStatus fontSizeValidationStatus() { return fontSizeValidator.getValidationStatus(); } + public ValidationStatus customPathToThemeValidationStatus() { + return customPathToThemeValidator.getValidationStatus(); + } + @Override public boolean validateSettings() { - if (fontOverrideProperty.getValue() && !fontSizeValidator.getValidationStatus().isValid()) { - fontSizeValidator.getValidationStatus().getHighestMessage().ifPresent(message -> + CompositeValidator validator = new CompositeValidator(); + + if (fontOverrideProperty.getValue()) { + validator.addValidators(fontSizeValidator); + } + + if (themeCustomProperty.getValue()) { + validator.addValidators(customPathToThemeValidator); + } + + ValidationStatus validationStatus = validator.getValidationStatus(); + if (!validationStatus.isValid()) { + validationStatus.getHighestMessage().ifPresent(message -> dialogService.showErrorDialogAndWait(message.getMessage())); return false; } @@ -128,4 +181,22 @@ public BooleanProperty themeLightProperty() { public BooleanProperty themeDarkProperty() { return themeDarkProperty; } + + public BooleanProperty customThemeProperty() { + return themeCustomProperty; + } + + public StringProperty customPathToThemeProperty() { + return customPathToThemeProperty; + } + + public void importCSSFile() { + FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() + .addExtensionFilter(StandardFileType.CSS) + .withDefaultExtension(StandardFileType.CSS) + .withInitialDirectory(preferences.setLastPreferencesExportPath()).build(); + + dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file -> + customPathToThemeProperty.setValue(file.toAbsolutePath().toString())); + } } diff --git a/src/main/java/org/jabref/gui/preview/PreviewPanel.java b/src/main/java/org/jabref/gui/preview/PreviewPanel.java index d9732ecc447..e0d5841857c 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewPanel.java +++ b/src/main/java/org/jabref/gui/preview/PreviewPanel.java @@ -54,7 +54,7 @@ public PreviewPanel(BibDatabaseContext database, DialogService dialogService, Ex previewView = new PreviewViewer(database, dialogService, Globals.stateManager); previewView.setLayout(previewPreferences.getCurrentPreviewStyle()); previewView.setContextMenu(createPopupMenu()); - previewView.setTheme(this.preferences.get(JabRefPreferences.FX_THEME)); + previewView.setTheme(this.preferences.getTheme()); previewView.setOnDragDetected(event -> { previewView.startFullDrag(); diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index ad950c7f078..79993768b29 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -22,7 +22,7 @@ import org.jabref.gui.StateManager; import org.jabref.gui.util.BackgroundTask; import org.jabref.gui.util.TaskExecutor; -import org.jabref.gui.util.ThemeLoader; +import org.jabref.gui.util.Theme; import org.jabref.logic.exporter.ExporterFactory; import org.jabref.logic.l10n.Localization; import org.jabref.logic.preview.PreviewLayout; @@ -116,11 +116,11 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S }); } - public void setTheme(String theme) { - if (theme.equals(ThemeLoader.DARK_CSS)) { + public void setTheme(Theme theme) { + if (theme.getType() == Theme.Type.DARK) { // We need to load the css file manually, due to a bug in the jdk // TODO: Remove this workaround as soon as https://github.com/openjdk/jfx/pull/22 is merged - URL url = JabRefFrame.class.getResource(ThemeLoader.DARK_CSS); + URL url = JabRefFrame.class.getResource(theme.getPath().getFileName().toString()); String dataUrl = "data:text/css;charset=utf-8;base64," + Base64.getEncoder().encodeToString(StringUtil.getResourceFileAsString(url).getBytes()); diff --git a/src/main/java/org/jabref/gui/util/BaseDialog.java b/src/main/java/org/jabref/gui/util/BaseDialog.java index 921be10e748..1995d34ce7d 100644 --- a/src/main/java/org/jabref/gui/util/BaseDialog.java +++ b/src/main/java/org/jabref/gui/util/BaseDialog.java @@ -36,7 +36,7 @@ protected BaseDialog() { setDialogIcon(IconTheme.getJabRefImageFX()); setResizable(true); - Globals.getThemeLoader().installCss(getDialogPane().getScene(), Globals.prefs); + Globals.prefs.getTheme().installCss(getDialogPane().getScene()); } private Optional