Recipes
Custom theme from JSON
Load a custom Lumis theme from JSON and use it for highlighting.
Use a theme JSON file produced by the Neovim colorscheme generation recipe, or your own theme definition. Keep its source license and notices with it.
import theme from './my_theme.json' with { type: 'json' };
import { highlight } from '@lumis-sh/lumis';
import { htmlInline } from '@lumis-sh/lumis/formatters';
import javascript from '@lumis-sh/wasm-javascript';
const html = await highlight(
'const x = 1',
htmlInline({ language: javascript, theme }),
);Use Node.js JSON modules or a bundler with JSON import support. Install
@lumis-sh/lumis and @lumis-sh/wasm-javascript for this example.