Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. In this file, make two new objects, one calledmyThemeLightand the other calledmyThemeDark. We will use these to separate out light and dark mode colours.

...

Code Block
languagetypescript
// Light palette
const myThemeLight = {

};

// Dark palette
const myThemeDark = {

};

export { myThemeLight, myThemeDark }
  1. Import the createTheme function from@mui/material/styles. This will generate a theme based on the options received.

...

Code Block
languagetypescript
import { createTheme } from "@mui/material/styles";

// Light palette
const myThemeLight = {

};

// Dark palette
const myThemeDark = {

};

export { myThemeLight, myThemeDark }

  1. Import baseTheme, and use the spread operator to gain all styles from the base file.

...

Code Block
languagetypescript
import { createTheme } from "@mui/material/styles";
import baseTheme from "./baseTheme";

// Light palette
const myThemeLight = {
  ...baseTheme
};

// Dark palette
const myThemeDark = {
  ...baseTheme
};

export { myThemeLight, myThemeDark }
  1. Define a colour palette, and specify what mode this colour palette is for:“light"or“dark"

...