53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
const PRISMJS_THEMES = [
|
|
'ateliersulphurpool-light',
|
|
'coldark-cold',
|
|
'coy',
|
|
'duotone-light',
|
|
'ghcolors',
|
|
'gruvbox-light',
|
|
'material-light',
|
|
'one-light',
|
|
'vs',
|
|
'atom-dark',
|
|
'cb',
|
|
'coldark-dark',
|
|
'dark',
|
|
'dracula',
|
|
'duotone-dark',
|
|
'duotone-earth',
|
|
'duotone-forest',
|
|
'duotone-sea',
|
|
'duotone-space',
|
|
'gruvbox-dark',
|
|
'holi',
|
|
'hopscotch',
|
|
'lucario',
|
|
'material-dark',
|
|
'material-oceanic',
|
|
'night-owl',
|
|
'nord',
|
|
'one-dark',
|
|
'pojoaque',
|
|
'shades-of-purple',
|
|
'solarized-dark-atom',
|
|
'tomorrow',
|
|
'vsc-dark-plus',
|
|
'xonokai',
|
|
'z-touch',
|
|
];
|
|
const isValidTheme = (theme) =>
|
|
// @ts-expect-error: Actual assertion here
|
|
PRISMJS_THEMES.includes(theme);
|
|
export const getTheme = (options) => ({
|
|
light: isValidTheme(options.themes?.light)
|
|
? options.themes?.light
|
|
: isValidTheme(options.theme)
|
|
? options.theme
|
|
: 'nord',
|
|
dark: isValidTheme(options.themes?.dark)
|
|
? options.themes?.dark
|
|
: isValidTheme(options.theme)
|
|
? options.theme
|
|
: 'nord',
|
|
});
|