question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dark theme does not work in electron

See original GitHub issue

I am building a electron-react app and am using material-ui (latest v1.0) with success. The controls all seem to display fine - as far as I can see. I use TypeScript and vscode on Windows 10.

I use this code in the assumption it will select the dark theme for the material-ui:

const appTheme = createMuiTheme({
    palette: {
      type: "dark", // does not work??
    }
  });

and have my app react components wrapped with the MuiThemeProvider:

<MuiThemeProvider theme={appTheme}>
    <App />
</MuiThemeProvider>

How I understood it, this should be enough to have theme-support.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I expect to select the dark theme with this code.

Current Behavior

No reported errors (as far as I can see) and the light theme (default) is used.

Steps to Reproduce (for bugs)

I don’t think codesandbox runs electron…?

  1. Use in electron is a valid use-case (is it not?).
  2. Brings to light a bug or omission.
  3. Would help me tremendously with my project 😉

Context

Making an electron desktop app where I would like to (re)use the material-ui react components.

Your Environment

Running vscode on Windows 10

dependencies: “express”: “^4.16.2”, “material-ui”: “^1.0.0-beta.25”, “material-ui-icons”: “^1.0.0-beta.17”, “morgan”: “^1.9.0”, “node-hid”: “^0.5.7”, “prop-types”: “^15.6.0”, “react”: “^16.2.0”, “react-dom”: “^16.2.0”, “react-redux”: “^5.0.6”, “react-swipeable-views”: “^0.12.12”, “redux”: “^3.7.2”, “typed-rest-client”: “^0.15.1”, “typeface-roboto”: “0.0.45”

dev-dependencies: “@types/prop-types”: “^15.5.2”, “@types/express”: “^4.0.39”, “@types/jest”: “^21.1.8”, “@types/morgan”: “^1.7.35”, “@types/node”: “^8.0.55”, “@types/node-hid”: “^0.5.2”, “@types/react”: “^16.0.31”, “@types/react-dom”: “^16.0.3”, “@types/react-redux”: “^5.0.14”, “@types/react-swipeable-views”: “^0.12.0”, “electron”: “^1.7.9”, “electron-rebuild”: “^1.6.0”, “jest”: “^22.0.3”, “ts-jest”: “^22.0.0”, “tslint”: “^5.8.0”, “tslint-react”: “^3.2.0”, “typescript”: “^2.6.2”

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
obiwanjacobicommented, Dec 29, 2017

I’ll try to make an isolated project that demonstrates the problem.

0reactions
oliviertassinaricommented, Dec 29, 2017

I have called it Reboot after all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dark Mode | Electron
Run the example using Electron Fiddle and then click the "Toggle Dark Mode" button; the app should start alternating between a light and...
Read more >
[Windows] Title bar does not respect dark mode #23479 - GitHub
Issue Details​​ themeSource to 'dark' (or 'system' and setting the system theme to 'dark'), the title bar on Windows remains light. On macOS,...
Read more >
Dark mode detection in Node/Electron - Stack Overflow
"electron's guide to implement dark mode only works when the user clicks a button to manually change it to dark mode" - uh,...
Read more >
Make your Electron app Dark Mode compatible - Medium
With the recent public release of macOS Mojave and as a developer, I'm sure you've already got a ton of requests to make...
Read more >
Managing Themes in ElectronJS - GeeksforGeeks
Any UI rendered by the Electron application on Linux and Windows including context-menus, devTools, etc will use the dark themed UI. The same ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found