I use Rehype Pretty Code for the website with nextjs. How to use light dark theme. Below is the configuration file
const rehypePrettyCodeOptions: Partial<Options> = {
theme: {
dark: JSON.parse(
fs.readFileSync(require.resolve('https://raw.githubusercontent.com/shikijs/shiki/main/packages/shiki/themes/github-dark.json'), 'utf-8')
),
light: JSON.parse(
fs.readFileSync(require.resolve('https://raw.githubusercontent.com/shikijs/shiki/main/packages/shiki/themes/github-light.json'), 'utf-8')
),
onVisitHighlightedLine(node) {
node.properties.className.push("line--highlighted")
},
onVisitHighlightedWord(node) {
node.properties.className = ["word--highlighted"]
},
};
how does it work.