Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Material UI: Theme Colors are not applied to App

I would like to change the primary and secondary color of Material UI. However, the colors are not applied to the controls, e.g. Buttons or Fab. The default colors are still used. What do I miss here?

index.js

/* Material UI */

import { ThemeProvider, createTheme } from '@material-ui/core/styles';

const theme = createTheme({
  palette: {
    primary: { main: "#e91e63", contrastText: "#fff" },
    secondary: { main: "#03a9f4", contrastText: "#fff" }
  }
});

ReactDOM.render(
  <React.StrictMode>
    <LoadingProvider>
      <ToastContainer toastClassName="dark-toast" position="bottom-center" />
      <BrowserRouter>
        <ThemeProvider theme={theme}>
          <App />
        </ThemeProvider>
      </BrowserRouter>
    </LoadingProvider>
  </React.StrictMode>,
  document.getElementById('root')
);

Any.js

<MUI.Fab color="primary" aria-label="add" onClick={() => setShowFileAdd(true)}>
 <span className="material-icons"> add </span>
</MUI.Fab>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

  1. List item

If you use old version of Maretial-ui: Try to wrap your Root component with MuiThemeProvider in your App component

// App.js
import { createTheme, MuiThemeProvider } from '@material-ui/core/styles';
import Root from './Root';

const theme = createTheme({
  palette: {
    primary: { main: "#e91e63", contrastText: "#fff" },
    secondary: { main: "#03a9f4", contrastText: "#fff" }
  }
});

function App() {
  return (
    <MuiThemeProvider theme={theme}>
      <Root />
    </MuiThemeProvider>
  );
}

If you use a new version of Material-ui (MUI):

import { createTheme, ThemeProvider } from '@mui/material/styles';

....

function App() {
  return (
    <ThemeProvider theme={theme}>
      <Root />
    </ThemeProvider>
  );
}
about 4 years ago · Juan Pablo Isaza Report

0

The issue was kinda weird. I had to replace the import to:

import { createTheme, ThemeProvider } from '@mui/material/styles';
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!