diff --git a/CHANGELOG.md b/CHANGELOG.md index abb9743e802..b79ee54f344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112) - The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142) - We fixed an error where the number of matched entries shown in the group pane was not updated correctly. [#4441](https://github.com/JabRef/jabref/issues/4441) +- We fixed an error where the default color of a new group was white instead of dark gray. [#4868](https://github.com/JabRef/jabref/issues/4868) - We fixed an error mentioning "javafx.controls/com.sun.javafx.scene.control" that was thrown when interacting with the toolbar. - We fixed an error where a cleared search was restored after switching libraries. [#4846](https://github.com/JabRef/jabref/issues/4846) - We fixed an exception which occured when trying to open a non existing file from the "Recent files"-menu [#5334](https://github.com/JabRef/jabref/issues/5334) diff --git a/src/main/java/org/jabref/gui/groups/GroupDialog.java b/src/main/java/org/jabref/gui/groups/GroupDialog.java index 5847d72b766..68a5027d8dd 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialog.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialog.java @@ -39,6 +39,7 @@ import org.jabref.JabRefGUI; import org.jabref.gui.BasePanel; import org.jabref.gui.DialogService; +import org.jabref.gui.icon.IconTheme; import org.jabref.gui.search.rules.describer.SearchDescribers; import org.jabref.gui.util.BaseDialog; import org.jabref.gui.util.FileDialogConfiguration; @@ -370,11 +371,12 @@ groupName, getContext(), // configure for current type if (editedGroup == null) { // creating new group -> defaults! + colorField.setValue(IconTheme.getDefaultGroupColor()); explicitRadioButton.setSelected(true); setContext(GroupHierarchyType.INDEPENDENT); } else { nameField.setText(editedGroup.getName()); - editedGroup.getColor().ifPresent(colorField::setValue); + colorField.setValue(editedGroup.getColor().orElse(IconTheme.getDefaultGroupColor())); descriptionField.setText(editedGroup.getDescription().orElse("")); iconField.setText(editedGroup.getIconName().orElse("")); setContext(editedGroup.getHierarchicalContext()); diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 2eece37b6aa..864abe24598 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -196,12 +196,8 @@ public JabRefIcon getIcon() { } private JabRefIcon createDefaultIcon() { - Optional color = groupNode.getGroup().getColor(); - if (color.isPresent()) { - return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(color.get()); - } else { - return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(Color.web("#8a8a8a")); - } + Color color = groupNode.getGroup().getColor().orElse(IconTheme.getDefaultGroupColor()); + return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(color); } private Optional parseIcon(String iconCode) { @@ -248,7 +244,7 @@ boolean isMatchedBy(String searchString) { } public Color getColor() { - return groupNode.getGroup().getColor().orElse(IconTheme.getDefaultColor()); + return groupNode.getGroup().getColor().orElse(IconTheme.getDefaultGroupColor()); } public String getPath() { diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index 40682452586..3dec2613770 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -27,10 +27,6 @@ public class IconTheme { - /** - * JabRef's default color - */ - public static final Color DEFAULT_COLOR = JabRefPreferences.getInstance().getColor(JabRefPreferences.ICON_ENABLED_COLOR); public static final Color DEFAULT_DISABLED_COLOR = JabRefPreferences.getInstance().getColor(JabRefPreferences.ICON_DISABLED_COLOR); public static final javafx.scene.paint.Color SELECTED_COLOR = javafx.scene.paint.Color.web("#50618F"); private static final String DEFAULT_ICON_PATH = "/images/external/red.png"; @@ -60,8 +56,8 @@ private static InputStream getJabRefMaterialDesignIconsStream() throws IOExcepti return IconTheme.class.getResource("/fonts/JabRefMaterialDesign.ttf").openStream(); } - public static Color getDefaultColor() { - return DEFAULT_COLOR; + public static Color getDefaultGroupColor() { + return Color.web("#8a8a8a"); } public static Image getJabRefImageFX() { diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index e35ca7a1e61..60c7f191283 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -216,7 +216,6 @@ public class JabRefPreferences implements PreferencesService { public static final String ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR = "activeFieldEditorBackgroundColor"; public static final String INVALID_FIELD_BACKGROUND_COLOR = "invalidFieldBackgroundColor"; public static final String VALID_FIELD_BACKGROUND_COLOR = "validFieldBackgroundColor"; - public static final String ICON_ENABLED_COLOR = "iconEnabledColor"; public static final String ICON_DISABLED_COLOR = "iconDisabledColor"; public static final String FONT_SIZE = "fontSize"; public static final String OVERRIDE_DEFAULT_FONT_SIZE = "overrideDefaultFontSize"; @@ -600,7 +599,6 @@ private JabRefPreferences() { defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0"); // default icon colors - defaults.put(ICON_ENABLED_COLOR, "0:0:0"); defaults.put(ICON_DISABLED_COLOR, "200:200:200"); defaults.put(URL_COLUMN, Boolean.TRUE);