From 7836249b1a3eb01017978356d8bf99c17a6112e5 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 27 Feb 2019 22:58:09 +0700 Subject: [PATCH] Fix various Dark Mode issues --- source/net/filebot/ui/ThemeSupport.java | 13 +++++++++++++ source/net/filebot/ui/rename/FormatDialog.java | 6 +++--- source/net/filebot/util/ui/LinkButton.java | 3 ++- source/net/filebot/util/ui/SwingUI.java | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/net/filebot/ui/ThemeSupport.java b/source/net/filebot/ui/ThemeSupport.java index 203ab0f5..68da6198 100644 --- a/source/net/filebot/ui/ThemeSupport.java +++ b/source/net/filebot/ui/ThemeSupport.java @@ -62,6 +62,10 @@ public class ThemeSupport { return createLineBorder(getColor(0xACA899)); } + public static Color getLinkColor() { + return theme.getLinkSelectionForeground(); + } + public static LinearGradientPaint getPanelBackgroundGradient(int x, int y, int w, int h) { float[] gradientFractions = { 0.0f, 0.5f, 1.0f }; Color[] gradientColors = { getColor(0xF6F6F6), getColor(0xF8F8F8), getColor(0xF3F3F3) }; @@ -120,6 +124,11 @@ public class ThemeSupport { public boolean isDark() { return true; } + + @Override + public Color getLinkSelectionForeground() { + return new Color(0x5195C4); + } }, Nimbus { @@ -146,6 +155,10 @@ public class ThemeSupport { return false; } + public Color getLinkSelectionForeground() { + return new Color(0x3399FF); + } + public abstract void setLookAndFeel() throws Exception; public static Theme forName(String name) { diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index 66cb9f7f..98723c11 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -223,9 +223,9 @@ public class FormatDialog extends JDialog { editor.setBackground(template.getBackground()); content.add(editorScrollPane, "w 120px:min(pref, 420px), h pref, growx, wrap 4px, id editor"); - content.add(createImageButton(changeSampleAction), "sg action, w 25!, h 19!, pos n editor.y2+2 editor.x2 n"); - content.add(createImageButton(selectFolderAction), "sg action, w 25!, h 19!, pos n editor.y2+2 editor.x2-(27*1) n"); - content.add(createImageButton(showRecentAction), "sg action, w 25!, h 19!, pos n editor.y2+2 editor.x2-(27*2) n"); + content.add(createImageButton(changeSampleAction), "sg action, w 27!, h 24!, pos n editor.y2+2 editor.x2 n"); + content.add(createImageButton(selectFolderAction), "sg action, w 27!, h 24!, pos n editor.y2+2 editor.x2-(27*1) n"); + content.add(createImageButton(showRecentAction), "sg action, w 27!, h 24!, pos n editor.y2+2 editor.x2-(27*2) n"); content.add(help, "growx, wrap 25px:push"); diff --git a/source/net/filebot/util/ui/LinkButton.java b/source/net/filebot/util/ui/LinkButton.java index 0a586134..0ef4ca17 100644 --- a/source/net/filebot/util/ui/LinkButton.java +++ b/source/net/filebot/util/ui/LinkButton.java @@ -1,6 +1,7 @@ package net.filebot.util.ui; import static net.filebot.Logging.*; +import static net.filebot.ui.ThemeSupport.*; import java.awt.Color; import java.awt.Cursor; @@ -20,7 +21,7 @@ import javax.swing.JButton; public class LinkButton extends JButton { private Color color = getForeground(); - private Color rolloverColor = new Color(0x3399FF); + private Color rolloverColor = getLinkColor(); public LinkButton(String text, String tooltip, Icon icon, URI uri) { this(new OpenUriAction(text, tooltip, icon, uri)); diff --git a/source/net/filebot/util/ui/SwingUI.java b/source/net/filebot/util/ui/SwingUI.java index 9bc7f6d8..b73ad882 100644 --- a/source/net/filebot/util/ui/SwingUI.java +++ b/source/net/filebot/util/ui/SwingUI.java @@ -3,6 +3,7 @@ package net.filebot.util.ui; import static java.util.Collections.*; import static javax.swing.JOptionPane.*; import static net.filebot.Logging.*; +import static net.filebot.Settings.*; import java.awt.Color; import java.awt.Component; @@ -62,7 +63,6 @@ import javax.swing.undo.UndoManager; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; -import net.filebot.Settings; public final class SwingUI { @@ -156,7 +156,7 @@ public final class SwingUI { // fix Windows 10 button padding button.setMaximumSize(new Dimension(36, 36)); - if (Settings.isMacApp()) { + if (isMacApp()) { button.setPreferredSize(new Dimension(28, 27)); } else { button.setPreferredSize(new Dimension(26, 26));