Skip to content

theme() with css variable colors doesn't work in .css files #8643

@maxsalven

Description

@maxsalven

What version of Tailwind CSS are you using?

v3.1.3

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

postcss 8.4.14

What version of Node.js are you using?

v16.13.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://play.tailwindcss.com/eoS0xJO1cm

Describe your issue

If you use css variable for colors, then theme doesn't work in .css files:

module.exports = {
  theme: {
    colors: {
      blue: 'rgb(var(--blue) / <alpha-value>)',
    },
  },
  plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --blue: 0 0 255;
}

.custom-class {
  color: theme("colors.blue");
}

Generated css:

.custom-class {
    color: rgb(var(--blue) / <alpha-value>);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions