RFR: 7124282: [macosx] Can't see table cell highlighter when the highlight border is the same color as the cell. [v10]
Harshitha Onkar
duke at openjdk.java.net
Tue Apr 12 00:13:13 UTC 2022
> Previously while tabbing through the JTable cell, the cell highlighter/focus ring was not visible against the selection background.
>
> Changes are made to Aqua LAF to derive a lighter focus ring color by changing saturation and setting brightness component to 100% of original focus ring color so that it is visible while tabbing through `JTable` cells. A new method is added for this purpose which takes in `focusRingColor`, does adjustment to saturation and brightness and returns a new focus ring color. There are edge cases where the HSB transformation does not yield the right focus ring color, for these cases a default color is returned.
>
> **Edge Cases**
> 
>
> The edge case condition consists of two parts –
> To handle white/black colors - (hsbValues[0] == 0 && hsbValues[1] == 0) - representing hue and saturation of zero obtained for black, white or exactly grey (red=green=color) conditions
> To handle grayish colors - hsbValues[1] <= satGrayScale where satGrayScale <= 0.10 . For any given hue and brightness, a saturation of less than or equal to 10% represents grayish tint colors.
> (The second case was added to accommodate grayish focus ring color returned by system when Accent color = Graphite. The returned color is not exactly gray but grayish (r=135, g=135, b=140)).
> To accommodate a more generic case of grayish colors, the satGrayScale has a threshold or buffer of 0.10 or 10%.
>
> Used the following resources to test out different grayish colors and optimal saturation offsets used in `deriveLighterFocusRing()`.
>
> - [RapidTables](https://www.rapidtables.com/convert/color/rgb-to-hsl.html)
> - [Colorizer](http://colorizer.org/).
> - [Chart Link](https://codepen.io/HunorMarton/details/eWvewo)
>
> A test case is added to compare the RGB difference between the original focus ring color & selection background and the new focus ring color & selection background.
>
> PS: The native L&F (Mac OS) and Swing L&F for JTable cell tabbing differs (on native tables the cell background turns white on focus with a cell focus ring). Since the background for Swing tables can be set by users and also overridden by subclassing `DefaultTableCellRenderer`, and to adhere to current implementation of Swing, the white cell background changes are not incorporated. Only the Focus Ring/ Cell Highlighter is made more prominent.
Harshitha Onkar has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
- Merge branch 'master' into focusRing_7124282
- added new type property and changed method name
- Merge branch 'master' into focusRing_7124282
- added more generic condition for edge case and formatted line lengths
- Merge branch 'openjdk:master' into focusRing_7124282
- on-the-fly focus ring color changes added
- updated deriveContrastFocusRing method
- changed javadocs for the new method and expanded imports
- formatting changes to test case
- formatted line lengths, added method-level comments
- ... and 1 more: https://git.openjdk.java.net/jdk/compare/df9f0c9c...c796a99d
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/7768/files
- new: https://git.openjdk.java.net/jdk/pull/7768/files/3e7afcdb..c796a99d
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7768&range=09
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7768&range=08-09
Stats: 136076 lines in 1047 files changed: 98527 ins; 5221 del; 32328 mod
Patch: https://git.openjdk.java.net/jdk/pull/7768.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7768/head:pull/7768
PR: https://git.openjdk.java.net/jdk/pull/7768
More information about the client-libs-dev
mailing list