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

270
Visualizações
How to add background color using tailwind when i have the hex code for the color?

What I'm trying to achieve is I have a list that I receive from an API call where I have the color in hexcode, for example, color: #00FF00

      {stages.map((item) => {
        return (
          <tr className="bg-white">
            <td className="flex px-3 justify-evenly ">
              <span className="mr-auto">{item.id}</span>
              <span className=" pr-5">{item.name}</span>
            </td>
            <td>
              <div className="flex justify-center items-center">
                <span className=" ">{item.id}</span>
              </div>
            </td>
            <td className="flex justify-center items-center p-3">
              <div className={`bg-[${item.color}] rounded-full px-2`}>
                <span className="self-center  ">{item.description}</span>
              </div>
            </td>

            <td>
              <div className="flex justify-center items-center">
                <span className=" ">--</span>
              </div>
            </td>
          </tr>
        );
      })}

the bit I'm concerned about is

              <div className={`bg-[${item.color}] rounded-full px-2`}>
                <span className="self-center  ">{item.description}</span>
              </div>

background-color doesn't seem to be working for me, what I'm receiving is the hex code so the color is #color, is there any way to write it better?

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

0

You can customize colors in tailwind.config.js Here are the guides for it: https://tailwindcss.com/docs/customizing-colors#app

or, you can also use tailwind arbitary value notation to generate class for the color you want

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