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

Add the ability to change to dark/light mode #4

Closed
Panquesito7 opened this issue Feb 15, 2021 · 2 comments
Closed

Add the ability to change to dark/light mode #4

Panquesito7 opened this issue Feb 15, 2021 · 2 comments
Assignees

Comments

@Panquesito7
Copy link
Member

It would be cool if there'd be an option to make the website be in dark mode.
For example, I use Dark Reader, and it looks pretty cool in Dark Mode:

Website using Dark Reader

@maltejur
Copy link
Collaborator

Should be relatively easy to do using material uis theming system. I already use this for the big jumbo on the home page, and it looks like this

<DarkThemeProvider>
  <div className={classes.outer}>
    <div className="container">
      <Typography className={classes.h1}>Hello, algorithms!</Typography>
      <Typography className={classes.h2}>
        Welcome to GitHub's largest open-source algorithm library
      </Typography>
      <div className={classes.input}>{search}</div>
    </div>
  </div>
</DarkThemeProvider>
import React from "react";
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";

const darkTheme = createMuiTheme({
  palette: {
    type: "dark",
    primary: {
      main: "#fff",
    },
  },
});

export default function DarkThemeProvider({ children }) {
  return <ThemeProvider theme={darkTheme}>{children}</ThemeProvider>;
}

You would just need to put the DarkThemeProvider in the _app component and add a switch. I quickly tried that and it looks pretty good, it just needs some tweaking at some points.

Screenshot_2021-02-15 The Algorithms
Screenshot_2021-02-15 Quick Sort - The Algorithms

@maltejur maltejur self-assigned this Feb 15, 2021
@maltejur
Copy link
Collaborator

8322344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants