Community
Participate
Working Groups
The following test code fails on Mac OS X: @Test public void testTransparentForeground() { Label label = createTestLabel(); // create display, shell and label Color transparent = Display.getDefault().getSystemColor(SWT.COLOR_TRANSPARENT); label.setForeground(transparent); int expected = transparent.getRGBA().alpha; int actual = label.getForeground().getRGBA().alpha; assertEquals(expected, actual); } Culprit is this piece of code Color getForegroundColor () { return foreground != null ? Color.cocoa_new (display, foreground) : defaultForeground (); } which calls this one public static Color cocoa_new(Device device, double /*float*/ [] handle) { return cocoa_new(device, handle, 255); } As can be seen, the last parameter (alpha) is set to the constant 255 instead of taking it from the handle[] array which contains the alpha channel at position 3.
Updated the constructor call in Cocoa Color class to honor the alpha channel from the handle array, via below git patch: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=3fa10aec500a4081c70ceb9a57998af702891944