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

229
Views
Changing theme primary color not affect button color

"@mui/material": "^5.5.3"

Hi there, I'm trying to style my MUI form using values, imported from the SCSS variables. Everything seems to be working fine (I can see passed values in devtools) except for the colors actually never change.

Registration.tsx

import {AppDataContext} from './context/app-data-context';
import {createTheme, ThemeProvider} from '@mui/material/styles';

export const Registration = () => {
    const appData = useContext(AppDataContext);
    const myTheme = useMemo(() => {
        const colors = appData.brandedSCSS.default;
        return createTheme({
            palette: {
                primary: {
                    main: colors.primary // #fdab0a
                },
                secondary: {
                    main: colors.secondary // #ffffff
                }
            }
        })
    }, [appData])

    return (
        <ThemeProvider theme={myTheme}>
           // some code here
        </ThemeProvider>
    );

Somewhere going down the components tree:

import {Button, CircularProgress, Grid} from "@mui/material";

// some code here

return (

//some code there

    <Button
        color="primary"
        type="submit"
    >
)

Theme seems to be applied correctly

enter image description here

but the buttons is still blue

enter image description here

What am I doing wrong? Thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

this is how i'm changing the default theme colors of mui

index.js

import { ThemeProvider } from "@mui/material"
// or import { ThemeProvider } from '@emotion/react';
import { createTheme } from '@mui/material/styles';

const theme = createTheme({
    palette: {
        primary: {
            main: '#554149',
            contrastText: '#fff',
        },
        secondary: {
            main: '#00AA9C',
            contrastText: '#fff',
        },
        info: {
            main: "#906D9A",
            contrastText: '#fff',
        },
    },
})

<ThemeProvider theme={theme}>
     <App/>
</ThemeProvider>

"@mui/material": "^5.0.6",
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!