Skip to content
Discussion options

You must be logged in to vote

Why it doesn't generate and use the color from the @theme?

This is because the JavaScript plugin API is mainly for v3 backwards compatibility. In v3, CSS variables weren't use and the values were used directly as you have experienced.

As a workaround, you can output the CSS variables yourself:

plugin.withOptions<Partial<Options>>(
  (options) => {
    const { "base-hue": baseHue } = { ...defaultOptions, ...options };
    const colors = myFunction(baseHue);

    addBase({
      // Use `colors` to convert to an object shape like:
      // ```
      // {
      //   '--color-plugin-400': 'oklch(…)',
      // },
      // ```
      ':root': ,
    });
  },
  (options) => {
    // ...
    return 

Replies: 1 comment 3 replies

Comment options

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

@wongjn
Comment options

wongjn Sep 1, 2025
Collaborator

@yvvki
Comment options

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