mantine icon indicating copy to clipboard operation
mantine copied to clipboard

[@mantine/prism] Feature: allow overriding PrismTheme

Open fbartho opened this issue 3 years ago • 0 comments

PR implementing: https://github.com/mantinedev/mantine/discussions/1528#discussion-4104092 Replaces #1529 (now off of master instead of dev).

Why

It'd be great if consumers could use @mantine/prism, while customizing the specific colors being selected for different language-tokens to better highlight what the user is trying to focus on.

Generally speaking, I find @mantine's color selections to be very legible, but as a slightly colorblind person, I strongly appreciate the ability to adjust which colors are selected for specific tokens.

By customizing the PrismTheme, a user can make specific tokens pop-out in a rendered code-block.

How

Expose the call-site of getPrismTheme so users can provide their own method matching the same signature.

  • https://github.com/mantinedev/mantine/blob/97349accc5632aefabb1a86d91a6f4b221e534cf/src/mantine-prism/src/Prism.tsx#L101-L106
  • https://github.com/mantinedev/mantine/blob/97349accc5632aefabb1a86d91a6f4b221e534cf/src/mantine-prism/src/prism-theme.ts#L186-L187

fbartho avatar Jun 13 '22 20:06 fbartho

Feature was released with 5.2.0 – https://mantine.dev/changelog/5-2-0/#custom-prism-themes

rtivital avatar Aug 18 '22 18:08 rtivital