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

125
Visualizações
custom palette not working in react js material ui

I am trying to customize the palette colors for my project but I'm able to use only main attribute of it and not other. I am using MUI under JavaScript not Typescript

import './App.css';
import {BrowserRouter as Router, Route, Routes} from 'react-router-dom'
import Navbar from './components/Navbar/Navbar';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import Home from './components/Home/Home';
import Contact from './components/Contact/Contact';
import Pricing from './components/Pricing/Pricing';
import About from './components/About/About';

const theme = createTheme({
  palette: {
    primary: {
      light: '#f5f6fc', //highlight
      main: '#f6f6f6',  //site bg gray...this works (light, dark doesn't)
      dark: '#000629',   //navbar items
      contrastText: '#fff', //main text large font
    },
    
    secondary: {
      light: '#cdd0d9', //paragraph text dark gray
      main: '#dce6ff',  // for content bg light blue......this works (light, dark doesn't)
      dark: '#ba000d',  //hover buttons
      contrastText: '#000',
    },
  },
});


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

0

For adding multiple primary/secondary colors, you'll need to use custom variables.

Replacing primary to myPrimaryColor or something of your choice will make it custom variable which can be used down the line.

const theme = createTheme({
    myPrimaryColor: {
        success: 'green',
        danger: 'red',
    },
}); 

followed by

`theme.myPrimaryColor.success` 
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