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

209
Visualizações
MUI React Theme palette contrastText doesn't work

I'm using MUI React to create a menu and I used the AppBar component. I want to customize in this way:

brown.myBrown = '#544846';
const brownTheme = createTheme({
    palette: {
        primary: {
            main: brown.myBrown,
            contrastText: grey[50]
        }
    }
});

The contrastText field doesn't work and the result is a brown appBar with also text color brown as show here:

Screenshot of AppBar component The menu items are visibile only when I hover on them.

How can I change the item color in grey[50]?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The value of contrastText only gets applied if you set the color property as follows in your AppBar component:

<AppBar color={'primary'}>

(Or to 'secondary' if you want to use the corresponding contrastText value.)

If you don't want to set that property you can also use this approach:

const theme = useTheme();
...
<AppBar [...] sx={{color: theme.palette.primary.contrastText}}>

color doesn't set the background-color but the color of descendants.

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