Skip to content

Conversation

@Niki2k1
Copy link
Contributor

@Niki2k1 Niki2k1 commented Oct 17, 2025

Description

I was trying to get Tailwind working with Vuetify and enabled layers. I had some issues with the theme overwriting my tailwind colors and such. So I created an option which lets me enable a layer for the generated theme.

Usage:

theme: {
  unimportant: true,
  layer: true, // or specify a custom name: 'my-custom-layer'
},

which then generates:

@layer vuetify-theme { 
 :root {
      --v-theme-background: 255,255,255;
      --v-theme-background-overlay-multiplier: 1;
      --v-theme-surface: 255,255,255;
      --v-theme-surface-overlay-multiplier: 1;
      /* ... */

@Niki2k1 Niki2k1 changed the title feat(theme) generate layer if option is provided feat(theme): generate layer if option is provided Oct 18, 2025
@Niki2k1 Niki2k1 marked this pull request as ready for review October 23, 2025 06:13
@KaelWD KaelWD added this to the v3.11.0 milestone Oct 29, 2025
@KaelWD
Copy link
Member

KaelWD commented Oct 29, 2025

This should use the same layer names as v4 for forwards compatibility:

lines.push(
'@layer background {\n',
...bgLines.map(v => ` ${v}`),
'}\n',
'@layer foreground {\n',
...fgLines.map(v => ` ${v}`),
'}\n',
)
}
return '@layer vuetify.theme {\n' + lines.map(v => ` ${v}`).join('') + '\n}'

@Niki2k1
Copy link
Contributor Author

Niki2k1 commented Oct 29, 2025

So I would remove the option for the custom name and set the layer name to vuetify.theme?
I believe foreground and background layer will be a v4 Feature right?

Should it still be opt-in via the layer: true option?

@J-Sek
Copy link
Contributor

J-Sek commented Oct 29, 2025

I believe foreground and background layer will be a v4 Feature right?

Edit: sorry, linked master previously, this is next:

@layer theme.background, theme.foreground, utilities;

@Niki2k1
Copy link
Contributor Author

Niki2k1 commented Oct 30, 2025

I updated the pr to align with the v4 version. If the layer option is set to true (is now a boolean only) the layer will get generated (with background and foreground like in v4) as well as the vuetify.theme

So this is basically a backport now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants