Skip to content

Using colorPalette in a shadows token? #2569

Answered by astahmer
NateWritesCode asked this question in Q&A
Discussion options

You must be logged in to vote

tldr: colorPalette can not be used in tokens / semanticTokens due to the way CSS works


let's say you have this tokens object in your config

export const tokens = defineTokens({
  shadows: {
    example: {
      value: '0px 1px 2px 0px {colors.colorPalette.600}',
    },
  },
})

although it seems valid, it's not (and it's actually reported by the CLI when config.validation is not explicitly set to none)

❯ pnpm panda
🐼 warn [config] ⚠️ Invalid config:
- [tokens] Missing token: `colors.colorPalette.300` used in `theme.tokens.shadows.example`

the reason why is that tokens will generate CSS variables using the config.cssVarRoot selector (1), whereas colorPalette will be applied through a matc…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by NateWritesCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants