diff --git a/CHANGELOG.md b/CHANGELOG.md index f951c7de222..06dd4948f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an exception which occurred when trying to import entries without an open library. [#5447](https://github.com/JabRef/jabref/issues/5447) - After successful import of one or multiple bib entries the main table scrolls to the first imported entry [#5383](https://github.com/JabRef/jabref/issues/5383) - We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452) - +- We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463) ### Removed diff --git a/docs/adr/index.md b/docs/adr/README.md similarity index 100% rename from docs/adr/index.md rename to docs/adr/README.md diff --git a/src/main/java/org/jabref/Globals.java b/src/main/java/org/jabref/Globals.java index 71466ee47c7..a4399b13207 100644 --- a/src/main/java/org/jabref/Globals.java +++ b/src/main/java/org/jabref/Globals.java @@ -40,7 +40,7 @@ public class Globals { public static final RemoteListenerServerLifecycle REMOTE_LISTENER = new RemoteListenerServerLifecycle(); public static final ImportFormatReader IMPORT_FORMAT_READER = new ImportFormatReader(); public static final TaskExecutor TASK_EXECUTOR = new DefaultTaskExecutor(); - // In the main program, this field is initialized in JabRef.java + // In the main program, this field is initialized in JabRefMain.java // Each test case initializes this field if required public static JabRefPreferences prefs; /** diff --git a/src/main/java/org/jabref/gui/Dark.css b/src/main/java/org/jabref/gui/Dark.css index 8df9935c460..b9ec0058a23 100644 --- a/src/main/java/org/jabref/gui/Dark.css +++ b/src/main/java/org/jabref/gui/Dark.css @@ -50,3 +50,8 @@ -jr-tooltip-fg: derive(-fx-light-text-color, 50%); } + +#previewBody{ + background-color: #272b38; /* -fx-control-inner-background*/ + color : #7d8591; /* -fx-mid-text-color*/ +} diff --git a/src/main/java/org/jabref/gui/preview/PreviewPanel.java b/src/main/java/org/jabref/gui/preview/PreviewPanel.java index 3f25375cf5b..941818ae8ef 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewPanel.java +++ b/src/main/java/org/jabref/gui/preview/PreviewPanel.java @@ -54,6 +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.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 dcef5afa063..4e1201b92dc 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -16,9 +16,11 @@ import org.jabref.Globals; import org.jabref.gui.ClipBoardManager; import org.jabref.gui.DialogService; +import org.jabref.gui.JabRefFrame; 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.logic.citationstyle.PreviewLayout; import org.jabref.logic.exporter.ExporterFactory; import org.jabref.logic.l10n.Localization; @@ -112,6 +114,13 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S } + public void setTheme(String theme) { + if (theme.equals(ThemeLoader.DARK_CSS)) { + previewView.getEngine().setUserStyleSheetLocation(JabRefFrame.class.getResource(ThemeLoader.DARK_CSS).toString()); + } + + } + private void highlightSearchPattern() { if (searchHighlightPattern.isPresent()) { String pattern = searchHighlightPattern.get().pattern().replace("\\Q", "").replace("\\E", ""); @@ -175,7 +184,7 @@ private void update() { } private void setPreviewText(String text) { - String myText = "" + JS_HIGHLIGHT_FUNCTION + "
" + text + "
"; + String myText = "" + JS_HIGHLIGHT_FUNCTION + "
" + text + "
"; previewView.getEngine().setJavaScriptEnabled(true); previewView.getEngine().loadContent(myText);