Skip to content

Inline theme variables do not respond to custom variants #18297

Answered by wongjn
rettimo asked this question in Help
Discussion options

You must be logged in to vote

This is due to the intrinsic behavior of @theme inline. In the two cases where it works, we get CSS like:

@layer theme {
  :root, :host {
    …
    --color-white: #fff;
    --color-content: var(--color-white);
    …
  }
}
…
.bg-content {
  background-color: var(--color-content);
}
…

Notice how bg-content references var(--color-content).

If we compare to the @theme inline CSS:

@layer theme {
  :root, :host {
    …
    --color-white: #fff;
    …
  }
}
…
.bg-content {
  background-color: var(--color-white);
}
…

Notice how bg-content references var(--color-white). Hence updating --color-content in any rule has no effect. Simply put, @theme inline is not really meant to be used in this way…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@rettimo
Comment options

@wongjn
Comment options

wongjn Jun 12, 2025
Collaborator

@rettimo
Comment options

Answer selected by rettimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #18296 on June 12, 2025 12:11.