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

[WIP] ml fixes for dark mode #33222

Closed
wants to merge 4 commits into from
Closed

[WIP] ml fixes for dark mode #33222

wants to merge 4 commits into from

Conversation

snide
Copy link
Contributor

@snide snide commented Mar 14, 2019

Summary

Fixes #30368

This is a WIP PR that touched a bunch of spots in ML. Prolly needs one more day of deeper testing, but if anyone from @elastic/ml-ui wants to give this a quick spin to spot things I missed give it a go. I changed some colors around to make them a little more K7 style, hopefully they fit with the mood. I made a util for picking euiColors based on theme (which should likely be someplace more global, will chat with @cchaos about that later), but also defined the ML vars in one spot so we can pull them in as needed. My guess is that there's lots more places in the JS that are using these that I should replace, but this is a good start and addresses most of the major issues.

image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@snide snide requested review from a team as code owners March 14, 2019 05:39
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json';

export const euiColorForTheme = (euiColor) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function seemed nice and generic. I had no idea where it should live so I put in ML for now so I could reuse it. Any ideas @cchaos?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can ask the platform team if they know a good spot to put this a service anyone can grab. But I'd name it more specifically too like getEuiThemeColorsForJS

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, you pass back the the actual color value, not just the object.... Maybe even make it more generic then like euiColor

@snide snide changed the title ml fixes for dark mode [WIP] ml fixes for dark mode Mar 14, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@walterra
Copy link
Contributor

Hey Dave! I like the idea that the chart's line and model plot area have a different color than the low severity anomalies. The chart's line and model plot are a "generic" color while the low severity anomalies are historically being blue as part of that severity color range. Just one nit pick thought: The brush element (the border and handles with arrows) to select the time range in the lower context chart is an interaction element so I think it would be better if it was the same blue as the buttons and links, what do you think?

@snide
Copy link
Contributor Author

snide commented Mar 14, 2019 via email

import chrome from '../../../../../src/legacy/ui/public/chrome';
const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not going to worry about it now, but this an instance where we'll run into trouble when we start having custom theming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. There will eventually be a theme provider. But at least if we use this it'll all be in one place so we just update the one file. That's why I like euiColorForTheme as a name? Guess it doesn't matter too much.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I was just thinking on the consumer side, they don't need to care about the theme part of it, they just care that they're getting the right color. So something simple like euiColor would be easier for them to remember. Though, maybe it shouldn't be prefixed with eui since it could be a custom theme. So maybe just getColor though that's probably too generic... dunno maybe more of a kibana service so kbnGetColor?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87
Copy link
Contributor

alvarezmelissa87 commented Mar 15, 2019

Heya @snide - thanks for your work on this! 😄 Just a couple of comments:

IMO keeping the severity colors - light blue, blue, yellow, orange, and red - consistent is rather important. Here, the light blue becomes gray.

image

image

The annotations are a bit hard to see - maybe more contrast?
image

@peteharverson
Copy link
Contributor

@snide on the whole these changes look great.

Echoing what @alvarezmelissa87 says, I think some of the anomaly severity colors need some tweaks. In the charts in the Single Metric Viewer and the Anomaly Explorer, the orange (scores 50-75) now looks more like a red, whilst the red color (scores 75-100) has become pink. Can we stick with the light blue, blue, yellow, orange, red colors, even if you think the exact shades need tweaking (e.g. for better accessibility contrast)?

Does the area outside the slider have enough contrast? Before it had a light gray color from the fill-opacity:0.1:

image

image

Your edits to the background color of the event rate chart in the multi/population wizard has shown up that the margin-left needs fine tuning in the code, for .event-rate-chart-loader - probably outside the scope of this PR!

multi_metric_no_results_pr

Do you think the font color for text on these cards in the the Data Visualizer has enough contrast? ('Calculated over all documents')
data_visualizer_card_text_dark_theme_pr

This filter bar is new for 7.1 - looks like we need to make some changes for dark theme here:
explorer_filter_bar_dark_theme

@snide snide removed v7.0.0 labels Apr 10, 2019
@spalger spalger added v7.2.1 and removed v7.2.0 labels Jun 25, 2019
@snide snide removed the v7.4.0 label Sep 10, 2019
@snide snide closed this Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Dark mode issues in ML UI components
7 participants