You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "eirikbakke (via GitHub)" <gi...@apache.org> on 2023/04/01 21:19:20 UTC

[GitHub] [netbeans] eirikbakke commented on a diff in pull request #5761: Improve the appearance of disabled icons on FlatLAF Dark (and a tiny improvement on FlatLAF Light)

eirikbakke commented on code in PR #5761:
URL: https://github.com/apache/netbeans/pull/5761#discussion_r1155177735


##########
platform/openide.util.ui/src/org/openide/util/ImageUtilities.java:
##########
@@ -1238,24 +1239,33 @@ Image.UndefinedProperty rather than null (see Javadoc spec for this method), but
         }
     }
 
-    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)      );

Review Comment:
   (The formula here is the same as before, by the way, just reformatted and substituting a different baseGray on Dark mode.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists