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

Fix metric contrast #16296

Merged
merged 2 commits into from
Jan 30, 2018
Merged

Fix metric contrast #16296

merged 2 commits into from
Jan 30, 2018

Conversation

timroes
Copy link
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
Member

@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
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.

@@ -54,6 +56,14 @@ export class MetricVisComponent extends Component {
return colors[label];
}

_needsLightText(bgColor) {
const color = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(bgColor);
Copy link
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
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
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
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