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

[Uptime] Use EUI color palette for charts/histograms #29439

Merged
merged 5 commits into from
Jan 31, 2019

Conversation

justinkambic
Copy link
Contributor

@justinkambic justinkambic commented Jan 28, 2019

Summary

Previously the charts/histograms in the Uptime app were using hardcoded default CSS colors red and green. We should at least adhere to the EUI color palette.

Update:

Now using EUI JSON variables per @snide's suggestion:
image

image

Old

image

Further direction

Please recommend a better way of doing this if it doesn't adhere to best practices. EUI expectations for this sort of thing is a little obscure to me at the moment and I'm happy to take direction.

Testing this PR

You should be able to load the charts on Overview/Monitor pages and see the new colors

@justinkambic justinkambic self-assigned this Jan 28, 2019
@justinkambic justinkambic added v7.0.0 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v6.7.0 labels Jan 28, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@snide
Copy link
Contributor

snide commented Jan 29, 2019

@justinkambic I'd suggest consuming the JSON variable files that exist in dist. Then you can flip them based on the theme in use and they'll work in both colorschemes. Specifically for charts, you should likely consume the vis palettes.

Some docs for this are in EUI's consuming.md docs.

https://github.com/elastic/eui/blob/master/wiki/consuming.md#reusing-the-variables-in-javascript

You can also see a working example in React in use by the Infra UI team over here. I don't recommend using styled components, but you can at least see a good example of theme switching there.

#29133

I'll add something more concrete in the docs in EUI's guidelines to show this stuff off now that Dark Theme is a real thing.

@justinkambic
Copy link
Contributor Author

@snide that's the kind of direction I was hoping for, thank you!

@justinkambic justinkambic force-pushed the uptime_use-eui-colors branch from fa962f1 to 8ce3bfb Compare January 29, 2019 16:05
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the changes.

@@ -25,14 +31,14 @@ export const SnapshotHistogram = ({ histogram }: SnapshotHistogramProps) => {
name={i18n.translate('xpack.uptime.snapshotHistogram.series.upLabel', {
defaultMessage: 'Up',
})}
color="green"
color={primaryColor}
Copy link
Contributor

Choose a reason for hiding this comment

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

To be safe I always recommend pulling from the EuiVisColor series for anything chart related because they're targeted towards color blindess in charts. https://elastic.github.io/eui/#/guidelines/colors

The rest of this looks solid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@snide the primaryColor value in this case is either euiDarkVars.euiColorVis1 or euiLightVars.euiColorVis1 - is that not an appropriate value to use?
https://github.com/elastic/kibana/pull/29439/files#diff-abd19a861ef67d295beeea16e5a44b0bR120
https://github.com/elastic/kibana/pull/29439/files#diff-abd19a861ef67d295beeea16e5a44b0bR126

@justinkambic
Copy link
Contributor Author

jenkins test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@justinkambic justinkambic merged commit f67e89b into elastic:master Jan 31, 2019
justinkambic added a commit to justinkambic/kibana that referenced this pull request Feb 6, 2019
* Add hardcoded eui primary/danger to charts/histograms.

* Use EUI JSON vars for color values.
justinkambic added a commit that referenced this pull request Feb 6, 2019
* Add hardcoded eui primary/danger to charts/histograms.

* Use EUI JSON vars for color values.
@justinkambic
Copy link
Contributor Author

Backported to:
6.x/6.7.0 6acd31f
#30178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v6.7.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants