Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 5463 #5481

Merged
merged 15 commits into from
Oct 20, 2019
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed some display errors in the preferences dialog and replaced some of the controls [#5033](https://github.com/JabRef/jabref/pull/5033) [#5047](https://github.com/JabRef/jabref/pull/5047) [#5062](https://github.com/JabRef/jabref/pull/5062) [#5141](https://github.com/JabRef/jabref/pull/5141) [#5185](https://github.com/JabRef/jabref/pull/5185) [#5265](https://github.com/JabRef/jabref/pull/5265) [#5315](https://github.com/JabRef/jabref/pull/5315) [#5360](https://github.com/JabRef/jabref/pull/5360)
- 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)

taerim25 marked this conversation as resolved.
Show resolved Hide resolved
- 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 preview theme did not change when the preerences were set in "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463)
taerim25 marked this conversation as resolved.
Show resolved Hide resolved

### Removed


Expand Down
57 changes: 57 additions & 0 deletions src/main/java/org/jabref/gui/preview/Dark_preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.root {
taerim25 marked this conversation as resolved.
Show resolved Hide resolved
-jr-theme: #2c9490;
-jr-accent: #255652;
-jr-selected: -jr-accent;
-jr-hover: #fff1;


-jr-red: #b71c1f;
-jr-light-red: #db1d2b;
-jr-green: #1cb631;
-jr-light-green: #28d93c;
-jr-blue: #2c2cb7;
-jr-light-blue: #3a3ad9;
-jr-purple: #b72486;
-jr-light-purple: #d927a8;
-jr-yellow: #b5b021;
-jr-orange: #b77620;

-jr-base: #141824;

-jr-background-alt: #151924;
-jr-menu-background: #141824;
-jr-toolbar: -jr-menu-background;
-jr-sidepane-background: #212330;
-jr-search-background: #2c2e3b;

-jr-sidepane-header-background: -jr-background-alt;
-jr-group-hits-bg: -jr-background-alt;
-jr-group-hits-fg: -fx-light-text-color;
-fx-control-inner-background: #272b38;

-fx-control-inner-background-alt: -fx-control-inner-background;

-fx-dark-text-color: black;
-fx-mid-text-color: #7d8591;
-fx-light-text-color: #9aa3af;
-jr-separator: #333744;
-fx-outer-border: #424758;

-jr-icon: -fx-light-text-color;
-jr-icon-active: derive(-fx-light-text-color, 50%);
-jr-icon-background-active: -jr-hover;
-jr-icon-background-armed: #fff2;

-jr-menu-foreground: -fx-light-text-color;
-jr-menu-item-foreground: -fx-light-text-color;
-jr-menu-forground-active: derive(-fx-light-text-color, 50%);

-fx-focused-text-base-color: -fx-dark-text-color;

-jr-tooltip-fg: derive(-fx-light-text-color, 50%);

}
body{
background-color: #212330; /* jr-sidepane-background*/
color:#7d8591;/* -fx-light-text-color*/
}
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/preview/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class PreviewPanel extends VBox {
private final JabRefPreferences preferences;
private BibEntry entry;
private DialogService dialogService;

public PreviewPanel(BibDatabaseContext database, DialogService dialogService, ExternalFileTypes externalFileTypes, KeyBindingRepository keyBindingRepository, JabRefPreferences preferences) {
this.keyBindingRepository = keyBindingRepository;
this.dialogService = dialogService;
Expand All @@ -54,6 +53,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();

Expand Down Expand Up @@ -99,6 +99,7 @@ public PreviewPanel(BibDatabaseContext database, DialogService dialogService, Ex

createKeyBindings();
updateLayout(previewPreferences, true);

taerim25 marked this conversation as resolved.
Show resolved Hide resolved
}

public void updateLayout(PreviewPreferences previewPreferences) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/jabref/gui/preview/PreviewViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S
previewView = new WebView();
setContent(previewView);
previewView.setContextMenuEnabled(false);

previewView.getEngine().getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {

if (newValue != Worker.State.SUCCEEDED) {
return;
}
Expand All @@ -111,7 +109,11 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S
});

}

public void setTheme(String theme){
if(theme.equals("Dark.css")){
taerim25 marked this conversation as resolved.
Show resolved Hide resolved
previewView.getEngine().setUserStyleSheetLocation(getClass().getResource("Dark_preview.css").toString());
taerim25 marked this conversation as resolved.
Show resolved Hide resolved
}
}
private void highlightSearchPattern() {
if (searchHighlightPattern.isPresent()) {
String pattern = searchHighlightPattern.get().pattern().replace("\\Q", "").replace("\\E", "");
Expand Down