Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass themes option to Shiki? #18

Open
karlhorky opened this issue Feb 19, 2024 · 2 comments
Open

Pass themes option to Shiki? #18

karlhorky opened this issue Feb 19, 2024 · 2 comments

Comments

@karlhorky
Copy link
Contributor

karlhorky commented Feb 19, 2024

Similar to #17 (customization of the Slide container style), it would be nice to also be able to customize the Shiki themes array option, so that a different highlighter can be used:

themes: [
`${
basename(root) === 'remdx'
? `/packages/vite-plugin-remdx/`
: `/node_modules/@nkzw/vite-plugin-remdx/`
}lib/licht`,

Maybe it makes sense as an option for @nkzw/vite-plugin-remdx?

@karlhorky
Copy link
Contributor Author

Workaround

Currently, I am using patch-package to patch the node_modules/@nkzw/vite-plugin-remdx/lib/licht.json file to include the theme that I want from the tm-themes package

@cpojer
Copy link
Collaborator

cpojer commented Feb 19, 2024

Yes, providing the themes as a plugin option to vite-plugin-remdx makes sense. Happy to merge a PR for that.

Keep in mind that the licht.json colors are not actually used directly! It's a bit hacky, but they get swapped for CSS variables named like this: https://github.com/nkzw-tech/remdx/blob/main/packages/vite-plugin-remdx/lib/ColorReplacements.tsx#L4-L46

With this, you can simply define your theme in CSS and overwrite the defaults: https://github.com/nkzw-tech/remdx/blob/main/packages/remdx/style.css#L29-L142

This way your slide deck will look great in light and dark mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants