Skip to content

Commit cbaf5ea

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fixnotonfxthread
* upstream/master: Amend the reference to JabRefReferences initialization (#5487) Fix for issue 5463 (#5481) Rename index.md to README.md
2 parents 269a786 + dfad2fd commit cbaf5ea

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
4848
- We fixed an exception which occurred when trying to import entries without an open library. [#5447](https://github.com/JabRef/jabref/issues/5447)
4949
- 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)
5050
- We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452)
51-
51+
- We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463)
5252

5353
### Removed
5454

File renamed without changes.

src/main/java/org/jabref/Globals.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class Globals {
4040
public static final RemoteListenerServerLifecycle REMOTE_LISTENER = new RemoteListenerServerLifecycle();
4141
public static final ImportFormatReader IMPORT_FORMAT_READER = new ImportFormatReader();
4242
public static final TaskExecutor TASK_EXECUTOR = new DefaultTaskExecutor();
43-
// In the main program, this field is initialized in JabRef.java
43+
// In the main program, this field is initialized in JabRefMain.java
4444
// Each test case initializes this field if required
4545
public static JabRefPreferences prefs;
4646
/**

src/main/java/org/jabref/gui/Dark.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@
5050

5151
-jr-tooltip-fg: derive(-fx-light-text-color, 50%);
5252
}
53+
54+
#previewBody{
55+
background-color: #272b38; /* -fx-control-inner-background*/
56+
color : #7d8591; /* -fx-mid-text-color*/
57+
}

src/main/java/org/jabref/gui/preview/PreviewPanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public PreviewPanel(BibDatabaseContext database, DialogService dialogService, Ex
5454
previewView = new PreviewViewer(database, dialogService, Globals.stateManager);
5555
previewView.setLayout(previewPreferences.getCurrentPreviewStyle());
5656
previewView.setContextMenu(createPopupMenu());
57+
previewView.setTheme(this.preferences.get(JabRefPreferences.FX_THEME));
5758
previewView.setOnDragDetected(event -> {
5859
previewView.startFullDrag();
5960

src/main/java/org/jabref/gui/preview/PreviewViewer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
import org.jabref.Globals;
1717
import org.jabref.gui.ClipBoardManager;
1818
import org.jabref.gui.DialogService;
19+
import org.jabref.gui.JabRefFrame;
1920
import org.jabref.gui.StateManager;
2021
import org.jabref.gui.util.BackgroundTask;
2122
import org.jabref.gui.util.TaskExecutor;
23+
import org.jabref.gui.util.ThemeLoader;
2224
import org.jabref.logic.citationstyle.PreviewLayout;
2325
import org.jabref.logic.exporter.ExporterFactory;
2426
import org.jabref.logic.l10n.Localization;
@@ -112,6 +114,13 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S
112114

113115
}
114116

117+
public void setTheme(String theme) {
118+
if (theme.equals(ThemeLoader.DARK_CSS)) {
119+
previewView.getEngine().setUserStyleSheetLocation(JabRefFrame.class.getResource(ThemeLoader.DARK_CSS).toString());
120+
}
121+
122+
}
123+
115124
private void highlightSearchPattern() {
116125
if (searchHighlightPattern.isPresent()) {
117126
String pattern = searchHighlightPattern.get().pattern().replace("\\Q", "").replace("\\E", "");
@@ -175,7 +184,7 @@ private void update() {
175184
}
176185

177186
private void setPreviewText(String text) {
178-
String myText = "<html>" + JS_HIGHLIGHT_FUNCTION + "<body><div id=\"content\">" + text + "</div></body></html>";
187+
String myText = "<html>" + JS_HIGHLIGHT_FUNCTION + "<body id=\"previewBody\"><div id=\"content\">" + text + "</div></body></html>";
179188
previewView.getEngine().setJavaScriptEnabled(true);
180189
previewView.getEngine().loadContent(myText);
181190

0 commit comments

Comments
 (0)