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

259
Views
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 answers
Answer question

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 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!