Bug 558258 - [macOS] Selection system colors are alpha-blended white
Summary: [macOS] Selection system colors are alpha-blended white
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.13   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-12 07:13 EST by Thomas Singer CLA
Modified: 2020-02-18 10:28 EST (History)
2 users (show)

See Also:


Attachments
Snippet to reproduce (2.73 KB, text/plain)
2019-12-12 07:14 EST, Thomas Singer CLA
no flags Details
macOS preferences (40.03 KB, image/png)
2019-12-12 07:15 EST, Thomas Singer CLA
no flags Details
Screenshot on macOS 10.14.5 (28.31 KB, image/png)
2019-12-12 07:16 EST, Thomas Singer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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?