Bug 558258

Summary: [macOS] Selection system colors are alpha-blended white
Product: [Eclipse Project] Platform Reporter: Thomas Singer <ts-swt>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: alexandr.miloslavskiy, ts-swt
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Snippet to reproduce
none
macOS preferences
none
Screenshot on macOS 10.14.5 none

Description Thomas Singer CLA 2019-12-12 07:13:46 EST
Please launch the attached snippet on macOS 10.14 or 10.15. You will see following output:

background = Color {255, 255, 255, 63}
foreground = Color {255, 255, 255, 255}

Now select table cell - and you will notice that it will be white on white background.
Comment 1 Thomas Singer CLA 2019-12-12 07:14:20 EST
Created attachment 281214 [details]
Snippet to reproduce
Comment 2 Thomas Singer CLA 2019-12-12 07:15:52 EST
Created attachment 281215 [details]
macOS preferences

Forgot to mention: you need to switch the macOS 'Accent colour' from the default blue (left) to graphite (right).
Comment 3 Thomas Singer CLA 2019-12-12 07:16:33 EST
Created attachment 281216 [details]
Screenshot on macOS 10.14.5
Comment 4 Alexandr Miloslavskiy CLA 2020-02-18 10:28:29 EST
Frankly, my findings surprised me: GC ignores alpha component of 'GC.setBackground()', 'GC.setForeground()' etc, replacing it with GC.getAlpha() instead.

This seems to happen on all 3 platforms, and for example on macOS the code seems to remain unchanged since initial implementation.

See for example 'GC.checkGC' on macOS:
NSColor bg = data.bg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f);

In 21st century, I see the behavior of ignoring Color's alpha as... ancient, at best.

I see a simple solution here: multiply gc.getAlpha() by Color.getAlpha(), problem solved. However, this is a breaking change, and could cause issues if for whatever reason some colors had wrong alpha values which were previously ignored. Yes, technically that's a bug in that other code, yet still...

What do you think?