-
Notifications
You must be signed in to change notification settings - Fork 73
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
Clean up focus background implementation #962
Conversation
Signed-off-by: Matt Provost <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but I'd like to get rid of "Transparency" in the var name.
Also need a changelog entry
$ouiFocusTransparency: lightOrDarkTheme(.1, .3) !default; | ||
$ouiFocusBackgroundColor: tintOrShade($ouiColorPrimary, ((1 - $ouiFocusTransparency) * 100%), ((1 - $ouiFocusTransparency) * 100%)) !default; | ||
$ouiFocusTransparency: lightOrDarkTheme(90%, 70%) !default; | ||
$ouiFocusBackgroundColor: tintOrShade($ouiColorPrimary, $ouiFocusTransparency, $ouiFocusTransparency) !default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplification reveals that this definition itself is a bit suspect. If you search the OUI stylesheets for tintOrShade
usage, you'll see that it's most common to specify more tint
than shade
(or, occasionally, the reverse). That makes sense from a color perception perspective.
There are only 2 other examples I found where the two percentages are the same:
$ouiButtonColorDisabled: tintOrShade($ouiTextColor, 70%, 70%) !default; |
color: tintOrShade($colorValue, 30%, 30%); |
So I don't think we should be afraid to further update this definition to be more in tune with other derived colors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point of tint or shade is more to specifically get the tint vs the shade functionality depending on dark or light colors. The actual color switching is done by the $ouiFocusTransparency
variable, so we will only ever get tint 90% on light mode and shade 70% on dark mode. It's just separated into 2 separate variables
Signed-off-by: Matt Provost <[email protected]>
I changed the shade amount to 65%. It seems to be a little better but I cant check with next theme because some of the colors are detected as dark when they should be light and vice versa |
Signed-off-by: Matt Provost <[email protected]>
Does this address #940 ? If so, LGTM!!! |
Yep, also changes contrast :) |
* Clean up focus background implementation Signed-off-by: Matt Provost <[email protected]> * Rename variable to ouiFocusChangePercent Signed-off-by: Matt Provost <[email protected]> * Update changelog Signed-off-by: Matt Provost <[email protected]> --------- Signed-off-by: Matt Provost <[email protected]> (cherry picked from commit 58380a5) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Clean up focus background implementation Signed-off-by: Matt Provost <[email protected]> * Rename variable to ouiFocusChangePercent Signed-off-by: Matt Provost <[email protected]> * Update changelog Signed-off-by: Matt Provost <[email protected]> --------- Signed-off-by: Matt Provost <[email protected]> (cherry picked from commit 58380a5) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Clean up some of the focus background implementation details
ouiFocusBackground
mixin actually use$color
argument$ouiFocusTransparency
an actual percentage instead of a float [0, 1]$ouiFocusTransparency
to respect it as a percentage instead of a float [0, 1]Before
After
Related issues
Fixes #948
Check List
yarn lint
yarn test-unit
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.