This is an automated email from the ASF dual-hosted git repository.
ebakke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new c6e7f25fb1 Improve the appearance of disabled icons on dark LAFs, by
adjusting ImageUtilities.DisabledButtonFilter.
c6e7f25fb1 is described below
commit c6e7f25fb14e3a437276e83965c63e5bf3c63607
Author: Eirik Bakke <[email protected]>
AuthorDate: Sat Apr 1 17:13:02 2023 -0400
Improve the appearance of disabled icons on dark LAFs, by adjusting
ImageUtilities.DisabledButtonFilter.
Also adjust the disabled TabControlIcon color on both FlatLAF Light and
FlatLAF Dark, to make these buttons more obviously disabled.
---
.../swing/laf/flatlaf/FlatDarkLaf.properties | 2 ++
.../netbeans/swing/laf/flatlaf/FlatLaf.properties | 2 +-
.../src/org/openide/util/ImageUtilities.java | 30 ++++++++++++++--------
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
index 374489a103..c5b28b468e 100644
---
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
+++
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
@@ -50,6 +50,8 @@ EditorTab.underlineColor=$TabbedPane.underlineColor
EditorTab.inactiveUnderlineColor=#00000000
EditorTab.tabSeparatorColor=darken($Component.borderColor,15%)
+TabControlIcon.disabledForeground=lighten(@background,15%)
+
#---- ViewTab ----
ViewTab.background=$EditorTab.background
diff --git
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
index 72b253d074..4a28bafb68 100644
---
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
+++
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
@@ -85,7 +85,7 @@ nb.completion.selectedForeground=@selectionForeground
#---- TabControlIcon ----
TabControlIcon.foreground=tint(@foreground,40%)
-TabControlIcon.disabledForeground=lighten($TabControlIcon.foreground,25%)
+TabControlIcon.disabledForeground=lighten($TabControlIcon.foreground,27%)
TabControlIcon.rolloverBackground=$Button.toolbar.hoverBackground
TabControlIcon.pressedBackground=$Button.toolbar.pressedBackground
TabControlIcon.close.rolloverBackground=#c74f50
diff --git a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
index f25db81bfd..d66dd82b63 100644
--- a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
+++ b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
@@ -457,7 +457,8 @@ public final class ImageUtilities {
/* FilteredIcon's Javadoc mentions a caveat about the Component
parameter that is passed to
Icon.paintIcon. It's not really a problem; previous implementations
had the same
behavior. */
- return FilteredIcon.create(DisabledButtonFilter.INSTANCE, icon);
+ return FilteredIcon.create(isDarkLaF()
+ ? DisabledButtonFilter.INSTANCE_DARK :
DisabledButtonFilter.INSTANCE_LIGHT, icon);
}
/**
@@ -1238,24 +1239,33 @@ public final class ImageUtilities {
}
}
- private static class DisabledButtonFilter extends RGBImageFilter {
- public static final RGBImageFilter INSTANCE = new
DisabledButtonFilter();
+ private static final class DisabledButtonFilter extends RGBImageFilter {
+ public static final RGBImageFilter INSTANCE_LIGHT = new
DisabledButtonFilter(false);
+ public static final RGBImageFilter INSTANCE_DARK = new
DisabledButtonFilter(true);
+ private final int baseGray;
- DisabledButtonFilter() {
+ DisabledButtonFilter(boolean dark) {
canFilterIndexColorModel = true;
+ baseGray = dark ? 0x444444 : 0x888888;
}
- public int filterRGB(int x, int y, int rgb) {
- // Reduce the color bandwidth in quarter (>> 2) and Shift 0x88.
- return (rgb & 0xff000000) + 0x888888 + ((((rgb >> 16) & 0xff) >>
2) << 16) + ((((rgb >> 8) & 0xff) >> 2) << 8) + (((rgb) & 0xff) >> 2);
+ @Override
+ public int filterRGB(int x, int y, int argb) {
+ return
+ // Keep the alpha channel unmodified.
+ (argb & 0xff000000) +
+ // Reduce the color bandwidth by a quarter (>> 2), and mix
with gray.
+ baseGray +
+ ((((argb >> 16) & 0xff) >> 2) << 16) +
+ ((((argb >> 8 ) & 0xff) >> 2) << 8) +
+ ((((argb ) & 0xff) >> 2) );
}
// override the superclass behaviour to not pollute
// the heap with useless properties strings. Saves tens of KBs
@Override
- public void setProperties(Hashtable props) {
- props = (Hashtable) props.clone();
- consumer.setProperties(props);
+ public void setProperties(Hashtable<?,?> props) {
+ consumer.setProperties((Hashtable<?,?>) props.clone());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists