question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default ringColor has opacity baked into it

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.22

What build tool (or framework if it abstracts the build tool) are you using?

postcss 8.4.6, webpack 5.65.0

What version of Node.js are you using?

For example: v17.5.0

What browser are you using?

Edge (Chromium)

What operating system are you using?

macOS

Reproduction URL

https://play.tailwindcss.com/DXtIUnfIC0

Describe your issue

When trying to set the default color for ringColor, it seems like an opacity of 0.5 is being applied regardless of the defined color. In my example I wanted to set the default ring color to be #000, but the output ends up becoming --tw-ring-color: rgb(0 0 0 / 0.5);.

Ideally, I’d like to be able override that default opacity with a defined opacity of my own choosing, or have the color defined for DEFAULT just override whatever opacity is being applied.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thecrypticacecommented, May 27, 2022

We’ve come up with a solution here that we think works well and will become the default whenever we hit v4 in the future. A custom default ring color will not have it’s opacity modified at all. Given that this is a breaking change it’s been put behind a future feature flag (respectDefaultRingColorOpacity) but will ship with v3.1:

{
    future: { respectDefaultRingColorOpacity: true },
    content: [],
    theme: {
      ringColor: {
        DEFAULT: '#ff7700',
      },
    },
  }

Given the above config the default ring color will be #ff7700 and not have an alpha channel applied to it. Thanks for the report and helping push us to figure this one out!

1reaction
adamwathancommented, May 11, 2022

Just revisiting this, spent like 45 minutes talking through it with @thecrypticace and I think we would like to change this so that the ringOpacity.DEFAULT value didn’t inject itself into your custom ringColor.DEFAULT value but it would be a breaking change, since anyone who has currently customized ringColor.DEFAULT would now see a different color after updating. It feels a little too breaking to just call it a bug fix to me unfortunately.

I think what we’re going to do is feature flag this fix so that anyone who runs into this problem and finds this issue can see that there’s a flag to opt-in to the breaking change early, and then in v4 we can make that the default and mention it in the upgrade guide.

Not sure when we will tackle this but leaving this as a note for myself anyways for when we look at this issue again 👍🏻

In the mean time, changing your ringOpacity.DEFAULT as explained earlier is the right way to solve this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ring Color - Tailwind CSS
By default, Tailwind makes the entire default color palette available as ring colors. You can customize your color palette by editing theme.colors or...
Read more >
Ring opacity is lost when setting colors with custom properties
Describe the problem: When setting theme colors with custom properties in the config, ring opacity is lost. module.exports = { theme: ...
Read more >
tailwind css - Focus ring opacity not working with arbitrary value
I expect your arbitrary value is being ignored. The color you see (a light blue I suspect) is coming from the default of...
Read more >
An argument against CSS opacity - TPGi
By default, all elements have an opacity of 1 , which means the foreground information is completely solid and you can't see the...
Read more >
material - A-Frame
The material component gives appearance to an entity. We can define properties such as color, opacity, or texture. This is often paired with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found