Skip to content

How to use semantic color names with specific namespaces #17705

Answered by wongjn
idenyigabriel asked this question in Help
Discussion options

You must be logged in to vote

Use the utility-specific namespaces like to have semantic colors:

@theme {
  --text-color-default: …;
  --background-color-default: …;
  --border-color-default: …;
}

Use standard CSS rules per each "theme":

@theme {
  …
}

@layer theme {
  @media (prefers-color-scheme: dark) {
    :root {
      --text-color-default: …;
      --background-color-default: …;
      --border-color-default: …;
    }
  }

  .red {
    --text-color-default: …;
    --background-color-default: …;
    --border-color-default: …;
  }
}

Replies: 1 comment 1 reply

Comment options

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

Answer selected by idenyigabriel
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