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.

Browser support is reduced by using rgb/opacity convention, maybe should favor rgba convention for legacy and modern browsers

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.18

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

Next.js 12.1.0

What version of Node.js are you using?

v12.19.0

What browser are you using?

Safari

What operating system are you using?

iOS

Reproduction URL

Background and font-color using rgb/opacity convention - https://play.tailwindcss.com/l1lAppmgGz?file=config Disabling backgroundOpacity and textOpacity makes it use hex but we lose opacity ability - https://play.tailwindcss.com/K1AcJBUjDP?file=config

Describe your issue

With the *Opacity core plugins enabled, rgb/opacity convention is used for colors. Older browser don’t support this format. Please use rgba convention as that is backwards and forwards compatible.

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
flyfineccommented, May 30, 2022

@adamwathan postcss-color-rgb I tried it and it doesn’t work, maybe it’s the reason why postcss 8 is not supported, this library has not been updated for a long time

@Noitidart, try postcss-preset-env https://github.com/csstools/postcss-preset-env https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-color-functional-notation

  1. npm install postcss-preset-env --save-dev
  2. Add plugin configuration to postcss.config.js, like:
module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
    'postcss-preset-env': {
      browsers: 'chrome >= 50', // configure a compatible browser version
    },
  },
};

If you use nextjs, delete the .next directory first, and then execute npm run dev to test

The plugin for postcss-preset-env will automatically convert CSS Colors 4 notation to compatible notation:

css colors 4 notation:
rgb(245 247 255 / var(--tw-bg-opacity))

compatible notation:
rgba(245, 247, 255, var(--tw-bg-opacity))

Hope it helps you

0reactions
Noitidartcommented, May 30, 2022

Thank you @flyfinec I was still struggling with this, I will try that out later this week thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RGBa Browser Support | CSS-Tricks
RGBa is a way to declare a color in CSS that includes alpha transparency support. It looks like this:
Read more >
"rgba" | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Fixing Browser Compatibility Issues With CSS Opacity & RGBA
This is a LambdaTest Experiment on CSS opacity for background color where we will learn how to fix the browser compatibility issues with...
Read more >
Replace modern rgba() notation in Tailwind CSS to support ...
Does anyone know a better way to do this? What would be a more elegant way to replace these? I do not make...
Read more >
rgba() and hsla() are legacy functions and aliases in modern ...
With rgb() / hsl() accepting transparency values, hsla() and rgba() became legacy functions and are now aliases for rgb() / hsl() . If...
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