From a979dfdca5c9570955f3fe409d6153b37fa48805 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 28 Feb 2019 15:39:07 +0700 Subject: [PATCH] Fix various Dark Mode issues --- .../net/filebot/ui/LanguageComboBoxCellRenderer.java | 5 +++-- source/net/filebot/ui/ThemeSupport.java | 10 +++++++--- source/net/filebot/ui/list/ListPanel.java | 4 ++-- source/net/filebot/ui/rename/FormatDialog.java | 3 +-- source/net/filebot/ui/sfv/ChecksumButton.java | 4 ++-- source/net/filebot/ui/sfv/ChecksumCellRenderer.java | 2 +- .../filebot/ui/subtitle/SubtitleAutoMatchDialog.java | 6 +++--- source/net/filebot/ui/subtitle/SubtitleViewer.java | 2 +- .../net/filebot/ui/subtitle/upload/FileRenderer.java | 4 ++-- .../filebot/ui/subtitle/upload/LanguageRenderer.java | 5 +++-- .../net/filebot/ui/subtitle/upload/MovieRenderer.java | 5 +++-- source/net/filebot/util/ui/ActionPopup.java | 5 +++-- source/net/filebot/util/ui/SelectButton.java | 2 +- 13 files changed, 32 insertions(+), 25 deletions(-) diff --git a/source/net/filebot/ui/LanguageComboBoxCellRenderer.java b/source/net/filebot/ui/LanguageComboBoxCellRenderer.java index d2618fa2..7e3972f4 100644 --- a/source/net/filebot/ui/LanguageComboBoxCellRenderer.java +++ b/source/net/filebot/ui/LanguageComboBoxCellRenderer.java @@ -1,6 +1,7 @@ package net.filebot.ui; -import java.awt.Color; +import static net.filebot.ui.ThemeSupport.*; + import java.awt.Component; import javax.swing.JLabel; @@ -47,7 +48,7 @@ public class LanguageComboBoxCellRenderer implements ListCellRenderer { if (index == 0 || index == model.favorites().size()) { // add separator border - c.setBorder(new CompoundBorder(new DashedSeparator(10, 4, Color.lightGray, list.getBackground()), c.getBorder())); + c.setBorder(new CompoundBorder(new DashedSeparator(10, 4, getPassiveColor(), list.getBackground()), c.getBorder())); } return c; diff --git a/source/net/filebot/ui/ThemeSupport.java b/source/net/filebot/ui/ThemeSupport.java index d18ad24a..3cc2407f 100644 --- a/source/net/filebot/ui/ThemeSupport.java +++ b/source/net/filebot/ui/ThemeSupport.java @@ -59,23 +59,27 @@ public class ThemeSupport { } public static Color getHelpPanelBackground() { - return getColor(0xFFFFE1); + return theme.isDark() ? new Color(0x313131) : new Color(0xFFFFE1); } public static Border getHelpPanelBorder() { return createLineBorder(getColor(0xACA899)); } + public static Color getErrorColor() { + return Color.red; + } + public static Color getLinkColor() { return theme.getLinkSelectionForeground(); } public static Color getActiveColor() { - return new Color(0x6495ED);// CornflowerBlue + return new Color(0x6495ED);// Cornflower Blue } public static Color getPassiveColor() { - return Color.gray; + return Color.lightGray; } public static Color getVerificationColor() { diff --git a/source/net/filebot/ui/list/ListPanel.java b/source/net/filebot/ui/list/ListPanel.java index e000c72d..81c23556 100644 --- a/source/net/filebot/ui/list/ListPanel.java +++ b/source/net/filebot/ui/list/ListPanel.java @@ -3,10 +3,10 @@ package net.filebot.ui.list; import static java.util.stream.Collectors.*; import static javax.swing.BorderFactory.*; import static net.filebot.Settings.*; +import static net.filebot.ui.ThemeSupport.*; import static net.filebot.util.ui.SwingUI.*; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; @@ -134,7 +134,7 @@ public class ListPanel extends JComponent { Border defaultBorder = new JTextField().getBorder(); Border okBorder = createCompoundBorder(defaultBorder, createEmptyBorder(2, 2, 2, 2)); - Border errorBorder = createCompoundBorder(createLineBorder(Color.RED, 1), createCompoundBorder(defaultBorder, createEmptyBorder(1, 1, 1, 1))); + Border errorBorder = createCompoundBorder(createLineBorder(getErrorColor(), 1), createCompoundBorder(defaultBorder, createEmptyBorder(1, 1, 1, 1))); editorScrollPane.setBorder(okBorder); diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index b10b952b..bd02a564 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -13,7 +13,6 @@ import static net.filebot.util.ExceptionUtilities.*; import static net.filebot.util.FileUtilities.*; import static net.filebot.util.ui.SwingUI.*; -import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; @@ -539,7 +538,7 @@ public class FormatDialog extends JDialog { status.setVisible(true); preview.setVisible(false); - editor.setForeground(Color.red); + editor.setForeground(getErrorColor()); } } diff --git a/source/net/filebot/ui/sfv/ChecksumButton.java b/source/net/filebot/ui/sfv/ChecksumButton.java index 689b6ae8..3dbebca7 100644 --- a/source/net/filebot/ui/sfv/ChecksumButton.java +++ b/source/net/filebot/ui/sfv/ChecksumButton.java @@ -1,11 +1,11 @@ package net.filebot.ui.sfv; -import static java.awt.Color.*; import static java.awt.Cursor.*; import static java.awt.Font.*; import static java.awt.RenderingHints.*; +import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; @@ -30,7 +30,7 @@ public class ChecksumButton extends JToggleButton { setMinimumSize(getPreferredSize()); setMaximumSize(getPreferredSize()); - setForeground(WHITE); + setForeground(Color.white); setFont(new Font(DIALOG, PLAIN, 11)); // as image button diff --git a/source/net/filebot/ui/sfv/ChecksumCellRenderer.java b/source/net/filebot/ui/sfv/ChecksumCellRenderer.java index 9e194df1..181fa25d 100644 --- a/source/net/filebot/ui/sfv/ChecksumCellRenderer.java +++ b/source/net/filebot/ui/sfv/ChecksumCellRenderer.java @@ -39,7 +39,7 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer { // if row state is ERROR and if we are not selected use text color RED, // else use default table colors - setForeground(isSelected ? table.getSelectionForeground() : isError ? Color.RED : isVerificationColumn(table, column) ? verificationForeground : table.getForeground()); + setForeground(isSelected ? table.getSelectionForeground() : isError ? getErrorColor() : isVerificationColumn(table, column) ? verificationForeground : table.getForeground()); setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); // use BOLD font on ERROR diff --git a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java index 690804ed..c7644a2b 100644 --- a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java +++ b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java @@ -384,12 +384,12 @@ class SubtitleAutoMatchDialog extends JDialog { // no subtitles found setText("No subtitles found"); setIcon(null); - setForeground(Color.gray); + setForeground(getPassiveColor()); } else { // no subtitles found setText("No subtitles selected"); setIcon(null); - setForeground(Color.gray); + setForeground(getPassiveColor()); } } else if (subtitleBean.getState() == StateValue.PENDING) { // download in the queue @@ -429,7 +429,7 @@ class SubtitleAutoMatchDialog extends JDialog { SubtitleDescriptorBean subtitleBean = (SubtitleDescriptorBean) value; if (isEditor && index == list.getModel().getSize() - 2) { - setBorder(new CompoundBorder(new DashedSeparator(10, 4, Color.lightGray, list.getBackground()), getBorder())); // this element is always the last one + setBorder(new CompoundBorder(new DashedSeparator(10, 4, getPassiveColor(), list.getBackground()), getBorder())); // this element is always the last one } if (value == null) { diff --git a/source/net/filebot/ui/subtitle/SubtitleViewer.java b/source/net/filebot/ui/subtitle/SubtitleViewer.java index e489de0b..7318d8d4 100644 --- a/source/net/filebot/ui/subtitle/SubtitleViewer.java +++ b/source/net/filebot/ui/subtitle/SubtitleViewer.java @@ -59,7 +59,7 @@ public class SubtitleViewer extends JFrame { private final JTextField filterEditor = createFilterEditor(); private Color defaultFilterForeground = filterEditor.getForeground(); - private Color disabledFilterForeground = Color.lightGray; + private Color disabledFilterForeground = getPassiveColor(); public SubtitleViewer(String title) { super(title); diff --git a/source/net/filebot/ui/subtitle/upload/FileRenderer.java b/source/net/filebot/ui/subtitle/upload/FileRenderer.java index 3376ab79..a9c0fae3 100644 --- a/source/net/filebot/ui/subtitle/upload/FileRenderer.java +++ b/source/net/filebot/ui/subtitle/upload/FileRenderer.java @@ -1,8 +1,8 @@ package net.filebot.ui.subtitle.upload; import static net.filebot.MediaTypes.*; +import static net.filebot.ui.ThemeSupport.*; -import java.awt.Color; import java.awt.Component; import java.io.File; @@ -31,7 +31,7 @@ class FileRenderer extends DefaultTableCellRenderer { setText(""); setToolTipText(null); setIcon(null); - setForeground(Color.LIGHT_GRAY); + setForeground(getPassiveColor()); } return this; diff --git a/source/net/filebot/ui/subtitle/upload/LanguageRenderer.java b/source/net/filebot/ui/subtitle/upload/LanguageRenderer.java index 9e3a3299..2cd32723 100644 --- a/source/net/filebot/ui/subtitle/upload/LanguageRenderer.java +++ b/source/net/filebot/ui/subtitle/upload/LanguageRenderer.java @@ -1,6 +1,7 @@ package net.filebot.ui.subtitle.upload; -import java.awt.Color; +import static net.filebot.ui.ThemeSupport.*; + import java.awt.Component; import javax.swing.DefaultListCellRenderer; @@ -29,7 +30,7 @@ class LanguageRenderer implements TableCellRenderer, ListCellRenderer { } else { c.setText(""); c.setIcon(null); - c.setForeground(Color.LIGHT_GRAY); + c.setForeground(getPassiveColor()); } return c; } diff --git a/source/net/filebot/ui/subtitle/upload/MovieRenderer.java b/source/net/filebot/ui/subtitle/upload/MovieRenderer.java index 6debcfe2..05522f5f 100644 --- a/source/net/filebot/ui/subtitle/upload/MovieRenderer.java +++ b/source/net/filebot/ui/subtitle/upload/MovieRenderer.java @@ -1,6 +1,7 @@ package net.filebot.ui.subtitle.upload; -import java.awt.Color; +import static net.filebot.ui.ThemeSupport.*; + import java.awt.Component; import javax.swing.Icon; @@ -31,7 +32,7 @@ class MovieRenderer extends DefaultTableCellRenderer { setText(""); setToolTipText(null); setIcon(null); - setForeground(Color.LIGHT_GRAY); + setForeground(getPassiveColor()); } return this; diff --git a/source/net/filebot/util/ui/ActionPopup.java b/source/net/filebot/util/ui/ActionPopup.java index bc22bab9..406b7492 100644 --- a/source/net/filebot/util/ui/ActionPopup.java +++ b/source/net/filebot/util/ui/ActionPopup.java @@ -1,6 +1,7 @@ package net.filebot.util.ui; -import java.awt.Color; +import static net.filebot.ui.ThemeSupport.*; + import java.awt.event.ActionListener; import javax.swing.Action; @@ -33,7 +34,7 @@ public class ActionPopup extends JPopupMenu { actionPanel.setOpaque(false); statusLabel.setFont(statusLabel.getFont().deriveFont(10f)); - statusLabel.setForeground(Color.GRAY); + statusLabel.setForeground(getPassiveColor()); setLayout(new MigLayout("nogrid, fill, insets 0")); diff --git a/source/net/filebot/util/ui/SelectButton.java b/source/net/filebot/util/ui/SelectButton.java index 70a72b40..b3f0e188 100644 --- a/source/net/filebot/util/ui/SelectButton.java +++ b/source/net/filebot/util/ui/SelectButton.java @@ -236,7 +236,7 @@ public class SelectButton extends JButton { icon.paintIcon(c, g2d, 4, 3); } - g2d.setPaint(Color.BLACK); + g2d.setPaint(Color.black); g2d.fill(arrow); }