Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-7467: Apply contrasting color to semantics component #2477

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

ambushwork
Copy link
Member

@ambushwork ambushwork commented Jan 8, 2025

What does this PR do?

In semantics tree we are not able to retrieve the complex color of some components including:

  • Checkbox
  • Switch
  • RadioButton.

Therefore we need to assume a contrasting color based on the background color to make them as much visible as possible.

The core function judges if the background is a bright one or dark one by Luma forumla , based on that, we can give the content a black color or white color.

Demo

The components turn white in dark mode:

image

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@ambushwork ambushwork force-pushed the yl/compose/contrast-color branch 2 times, most recently from d52731c to 30f4ecd Compare January 8, 2025 15:28
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 82.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 69.99%. Comparing base (ce2ed62) to head (6140c91).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...nal/mappers/semantics/SwitchSemanticsNodeMapper.kt 80.00% 2 Missing and 2 partials ⚠️
...appers/semantics/RadioButtonSemanticsNodeMapper.kt 66.67% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2477      +/-   ##
===========================================
+ Coverage    69.87%   69.99%   +0.13%     
===========================================
  Files          788      788              
  Lines        29536    29560      +24     
  Branches      4926     4932       +6     
===========================================
+ Hits         20636    20690      +54     
+ Misses        7528     7505      -23     
+ Partials      1372     1365       -7     
Files with missing lines Coverage Δ
...sessionreplay/compose/internal/utils/ColorUtils.kt 95.45% <100.00%> (+77.27%) ⬆️
...appers/semantics/RadioButtonSemanticsNodeMapper.kt 89.74% <66.67%> (-4.70%) ⬇️
...nal/mappers/semantics/SwitchSemanticsNodeMapper.kt 94.74% <80.00%> (-3.75%) ⬇️

... and 31 files with indirect coverage changes

@ambushwork ambushwork marked this pull request as ready for review January 8, 2025 16:43
@ambushwork ambushwork requested review from a team as code owners January 8, 2025 16:43
@ambushwork ambushwork force-pushed the yl/compose/contrast-color branch from 30f4ecd to 26f455a Compare January 9, 2025 07:54
@ambushwork ambushwork force-pushed the yl/compose/contrast-color branch from 26f455a to 6140c91 Compare January 9, 2025 12:39
@ambushwork ambushwork merged commit cad0d62 into develop Jan 9, 2025
23 checks passed
@ambushwork ambushwork deleted the yl/compose/contrast-color branch January 9, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants