Fix metric contrast#16296
Merged
Merged
Conversation
Contributor
thomasneirynck
left a comment
There was a problem hiding this comment.
LGTM, but not sure why we're validating color string.
| } | ||
|
|
||
| _needsLightText(bgColor) { | ||
| const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor); |
Contributor
There was a problem hiding this comment.
do we really need this? How does it arise that we don't know bgColor if of rgb() format?
Contributor
Author
There was a problem hiding this comment.
The colors are currently calculated by the getHeatmapColors function, which will always return a color in "rgb(...)" format to us.
This part will hopefully be cleaner once we build a proper palette color picker later on.
Contributor
Author
There was a problem hiding this comment.
Okay I guess I misread. We DO know that the color is in rgb() format. That's why we parse it here, into it's red, green and blue component, so we can pass three numeric values to the isDarkColor method.
timroes
added a commit
to timroes/kibana
that referenced
this pull request
Jan 30, 2018
* Update EUI to 0.0.14 * Make metrics text white when on dark color
timroes
added a commit
that referenced
this pull request
Jan 30, 2018
patrykkopycinski
pushed a commit
to patrykkopycinski/kibana
that referenced
this pull request
May 6, 2026
* Update EUI to 0.0.14 * Make metrics text white when on dark color
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make use of the new
isColorDarkfunction in EUI to figure out, whether we should print light text for a metric, because the background color is dark.Fixes #13548
Partly adresses #15866 (point 2), by introducing proper contrast on any color