Skip to content

Can the / opacity syntax be bypassed in unsupported environments? #13784

Answered by wongjn
type1fool asked this question in Help
Discussion options

You must be logged in to vote

Yep, that's what I mean by converting them to the aforementioned format. You'd write some code to convert them and reassign them, like:

const colors = require('tailwindcss/colors');

const convertColors = (colorObject) => {
  // …
};

const rgbaColors = convertColors(colors);

console.log(rgbaColors);
// {
//   violet: {
//     '50': 'rgba(…, <alpha-value>)',
//     '100': 'rgba(…, <alpha-value>)',
//     '200': 'rgba(…, <alpha-value>)',
//     …
// }

/** @type {import('tailwindcss').Config} */
export default {
  theme: {
    extend: {
      colors: rgbaColors,

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@type1fool
Comment options

@wongjn
Comment options

@type1fool
Comment options

@wongjn
Comment options

Answer selected by type1fool
@type1fool
Comment options

@type1fool
Comment options

Comment options

You must be logged in to vote
1 reply
@type1fool
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants