Skip to content

Fix metric contrast#16296

Merged
timroes merged 2 commits into
elastic:masterfrom
timroes:fix-metric-contrast
Jan 30, 2018
Merged

Fix metric contrast#16296
timroes merged 2 commits into
elastic:masterfrom
timroes:fix-metric-contrast

Conversation

@timroes
Copy link
Copy Markdown
Contributor

@timroes timroes commented Jan 25, 2018

Make use of the new isColorDark function 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

@timroes timroes added bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) Project:Accessibility labels Jan 25, 2018
@timroes timroes added v7.0.0 v6.3.0 Feature:MetricVis Metric visualization feature labels Jan 25, 2018
Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need this? How does it arise that we don't know bgColor if of rgb() format?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 timroes merged commit f346455 into elastic:master Jan 30, 2018
@timroes timroes deleted the fix-metric-contrast branch January 30, 2018 18:12
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
* Update EUI to 0.0.14

* Make metrics text white when on dark color
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience Feature:MetricVis Metric visualization feature Feature:Visualizations Generic visualization features (in case no more specific feature label is available) Project:Accessibility v6.3.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants