Skip to content

How can I configure the popups from twoslash to use the custom theme #1124

Answered by fuma-nama
tylersayshi asked this question in Q&A
Discussion options

You must be logged in to vote

For docs pages, you passed the package json to themes instead of colors (see shiki.ts).
There's a fix:

const arkdarkColors = await import("arkdark/arkdark.json", {
  with: { type: "json" },
});

export const shikiConfig = {
  ...rehypeCodeDefaultOptions,
  themes: {
    dark: arkdarkColors.default,
    light: arkdarkColors.default,
  },
  langs: [
    ...(rehypeCodeDefaultOptions.langs ?? []).filter(v => v !== 'ts'),
    { ...arktypeTextmate, name: "ts" } as never,
  ],
  transformers: [
    ...(rehypeCodeDefaultOptions.transformers ?? []),
    twoslash,
    transformerNotationErrorLevel(),
  ],
};

And Fumadocs UI's CodeBlock component has a keepBackground prop, you can use it like:

export 

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@fuma-nama
Comment options

@tylersayshi
Comment options

@fuma-nama
Comment options

Answer selected by tylersayshi
@tylersayshi
Comment options

@tylersayshi
Comment options

@tylersayshi
Comment options

@fuma-nama
Comment options

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