On Thu, 24 Mar 2022 17:09:21 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> Following was another suggestion and if we could use the code to produce 
>> brighter focus ring color
>> [Github 
>> Link](https://github.com/openjdk/jdk/commit/2f16ca0f59892fead80b209f7819bdbdb713329a)
>>  
>> 
>> Since the code uses a fixed value for minBrightnessDifference (which 
>> determines the returned color),  it did return brighter shade of the 
>> background, but it was not prominent/visible against the selection 
>> background color for all colors.
>> The same is true with using Color's brighter() and darker() methods to 
>> obtain the Cell Focus Ring color.
>> 
>> The idea behind the present solution is to obtain a cell focus ring color 
>> that is not just a brighter shade of selection background but to offset the 
>> hue and saturation such that it is prominent but at the same time a color 
>> close to the selection background color.
>
> I guess using "color close to selection background color" seems wrong to 
> me...either we need to use "blue" as used in native Numbers app...or if we 
> need to use system color, then maybe use the accent color (as defined in 
> System Preference) as focus ring color [ there's another Apple bug 
> [JDK-8261243](https://bugs.openjdk.java.net/browse/JDK-8261243) of JDK not 
> following accent color for focus ring for some widgets]...

@prsadhuk Thank you for mentioning 
[JDK-8261243](https://bugs.openjdk.java.net/browse/JDK-8261243) issue. It is 
similar to the JTable cell focus ring. 

If we decide to go with the blue focus ring it would cause the same issue as 
described in [JDK-8261243](https://bugs.openjdk.java.net/browse/JDK-8261243)

If we choose the system color approach, below are my observations -

The selectionBackground in JTable matches the accent color. The 
selectionBackground is a system color that maps to 
[alternateSelectedControlColor](https://developer.apple.com/documentation/appkit/nscolor/1533135-alternateselectedcontrolcolor)
 type property. On the right we can see that the selectionBackground color of 
JTable (which matches the accent color). 

![image](https://user-images.githubusercontent.com/95945681/160025649-565b8e9e-6c32-4823-9971-c7573eec1451.png)

Since the selectionBackground color for JTable is same as the accent color the 
focus ring won't be visible unless it is **LIGHTER** than accent color as 
suggested in the 
[JDK-8261243](https://bugs.openjdk.java.net/browse/JDK-8261243). We could 
change the present code not to do any hue offsets which would look as follows -

![image](https://user-images.githubusercontent.com/95945681/160028845-6f78f81c-7028-4951-a3c5-aea5beb23fdb.png)

-------------

PR: https://git.openjdk.java.net/jdk/pull/7768

Reply via email to