Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Last active March 17, 2022 09:18
Show Gist options
  • Save SahanAmarsha/22102181f235f96eb78f3c0ffadf17fd to your computer and use it in GitHub Desktop.
Save SahanAmarsha/22102181f235f96eb78f3c0ffadf17fd to your computer and use it in GitHub Desktop.
App.tsx after adding custom theme
import React from "react";
import {
Box,
CssBaseline,
Paper,
ThemeProvider,
Typography,
} from "@mui/material";
import { createTheme } from "@mui/material/styles";
function App() {
// define theme
const theme = createTheme({
palette: {
primary: {
light: "#63b8ff",
main: "#0989e3",
dark: "#005db0",
contrastText: "#000",
},
secondary: {
main: "#4db6ac",
light: "#82e9de",
dark: "#00867d",
contrastText: "#000",
},
},
});
return (
<ThemeProvider theme={theme}>
<CssBaseline />
<Box
height="100vh"
display="flex"
justifyContent="center"
alignItems="center"
flexDirection="column"
>
<Paper
elevation={3}
sx={{ padding: "1rem", backgroundColor: "secondary.light" }}
>
<Typography color="primary.dark" variant="h1">
Starter App
</Typography>
</Paper>
</Box>
</ThemeProvider>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment