Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda