Skip to content

v4: A theme key of 1 does not work in JS configs #19250

@gylxan

Description

@gylxan

What version of Tailwind CSS are you using?

4.1.15

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

vite 7.1.12

What version of Node.js are you using?

22

What browser are you using?

Chrome

What operating system are you using?

macOS, Windows

Reproduction URL

https://stackblitz.com/edit/vite-react-tailwind-apth9whe

Describe your issue

We are building libraries in our company and provide a Tailwind Preset from version 3.
In this preset we have color entries like adaptive-bg-basic-level-1(-pressed and -hovered).
Same for level-2 and level-3

For some reason with the new @config directive, level-2 and level-3 are working, but level-1 preset configurations aren't.

//preset.js
export default {
  theme: {
    colors: {
      adaptive: {
        bg: {
          basic: {
            level: {
              1: { // Does not work with @config
                DEFAULT: 'color-mix(in srgb,light-dark(#ffffff, #16181b) calc(<alpha-value> * 100%), transparent)',
                hovered: 'color-mix(in srgb,light-dark(#f3f3f5, #2e3036) calc(<alpha-value> * 100%), transparent)',
                pressed: 'color-mix(in srgb,light-dark(#edeef0, #3b3e44) calc(<alpha-value> * 100%), transparent)',
              },
              2: {
                DEFAULT: 'color-mix(in srgb,light-dark(#f3f3f5, #222428) calc(<alpha-value> * 100%), transparent)',
                hovered: 'color-mix(in srgb,light-dark(#edeef0, #3b3e44) calc(<alpha-value> * 100%), transparent)',
                pressed: 'color-mix(in srgb,light-dark(#e1e2e6, #484b53) calc(<alpha-value> * 100%), transparent)',
              },
              3: {
                DEFAULT: 'color-mix(in srgb,light-dark(#edeef0, #2e3036) calc(<alpha-value> * 100%), transparent)',
                hovered: 'color-mix(in srgb,light-dark(#e1e2e6, #16181b) calc(<alpha-value> * 100%), transparent)',
                pressed: 'color-mix(in srgb,light-dark(#c3c7ce, #0d0e11) calc(<alpha-value> * 100%), transparent)',
              },
            },
          },
        },
      },
    },
  },
}

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