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

[APM] Support EUI darkmode #29725

Closed
sorenlouv opened this issue Jan 31, 2019 · 5 comments
Closed

[APM] Support EUI darkmode #29725

sorenlouv opened this issue Jan 31, 2019 · 5 comments
Labels
bug Fixes for quality problems that affect the customer experience Team:APM All issues that need APM UI Team support

Comments

@sorenlouv
Copy link
Member

sorenlouv commented Jan 31, 2019

Switch between lightmode and darkmode depending on chrome.getUiSettingsClient().get('k7design')

To import dark mode:

import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';

Infra solution:

<EuiThemeProvider darkMode={darkMode}>
<HistoryContext.Provider value={history}>
<PageRouter history={history} />
</HistoryContext.Provider>
</EuiThemeProvider>

Notes:

  • @mattapperson has also set up variables alongside styled-components, and he may have insights to share
  • @pugnascotia offered to walk us through how they've done theming in cloud
@sorenlouv sorenlouv added Team:APM All issues that need APM UI Team support [zube]: Inbox labels Jan 31, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

@jasonrhodes
Copy link
Member

jasonrhodes commented Feb 12, 2019

I like how infra has done this using React context (#29133). If we want to imitate, we need to:

  1. Wrap the application with a new ThemeProvider which makes all of EUI's variables available via a prop, and will load light or dark mode vars depending on the theme UI setting (note: I like how Infra also includes the "dark mode" boolean here too so that custom color solutions can use the same theme consumer to make color decisions that can't be easily replaced with EUI)
  2. Replace all imports from '@elastic/eui/dist/eui_theme_light.json' with the new Theme Consumer

@sqren @ogupte @formgeist if you all are ok with this strategy, I'll update the ticket. Once this is done, fixing the remaining dark mode issues should become much easier.

@jasonrhodes jasonrhodes self-assigned this Feb 12, 2019
@formgeist
Copy link
Contributor

@jasonrhodes Sounds good to me 👍

@sorenlouv
Copy link
Member Author

sorenlouv commented Feb 18, 2019

I also like how Infra solved it. ThemeProvider seems like the way to go for styled-components 👍

@jasonrhodes did you think of a way to access theme variables outside styled-components, eg.

This was referenced Sep 5, 2019
@sorenlouv sorenlouv added [zube]: Backlog bug Fixes for quality problems that affect the customer experience labels Mar 26, 2020
@sorenlouv
Copy link
Member Author

Succeeded by #30048

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 Team:APM All issues that need APM UI Team support
Projects
None yet
Development

No branches or pull requests

5 participants