@@ -4,21 +4,28 @@ import react from '@astrojs/react';
44import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections' ;
55import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers' ;
66import { getInlineContentForPackage } from '@tutorialkit/theme' ;
7- import expressiveCode , { type ExpressiveCodePlugin } from 'astro-expressive-code' ;
7+ import expressiveCode , { type ExpressiveCodePlugin , type ThemeObjectOrShikiThemeName } from 'astro-expressive-code' ;
88import UnoCSS from 'unocss/astro' ;
99
1010export function extraIntegrations ( {
1111 root,
1212 expressiveCodePlugins = [ ] ,
13+ themes = [ 'light-plus' , 'dark-plus' ] ,
1314} : {
1415 root : string ;
1516 expressiveCodePlugins ?: ExpressiveCodePlugin [ ] ;
17+
18+ /**
19+ * Themes for Expressive Code.
20+ * Takes a tuple of themes, e.g. `[lightTheme, darkTheme]`.
21+ */
22+ themes ?: [ ThemeObjectOrShikiThemeName , ThemeObjectOrShikiThemeName ] ;
1623} ) {
1724 return [
1825 react ( ) ,
1926 expressiveCode ( {
2027 plugins : [ pluginCollapsibleSections ( ) , pluginLineNumbers ( ) , ...expressiveCodePlugins ] ,
21- themes : [ 'dark-plus' , 'light-plus' ] ,
28+ themes,
2229 customizeTheme : ( theme ) => {
2330 const isDark = theme . type === 'dark' ;
2431
@@ -35,13 +42,7 @@ export function extraIntegrations({
3542 } ;
3643 } ,
3744 themeCssSelector : ( theme ) => {
38- let customThemeName = 'light' ;
39-
40- if ( theme . name === 'dark-plus' ) {
41- customThemeName = 'dark' ;
42- }
43-
44- return `[data-theme='${ customThemeName } ']` ;
45+ return `[data-theme='${ theme . type } ']` ;
4546 } ,
4647 defaultProps : {
4748 showLineNumbers : false ,
0 commit comments