加载自定义主题
查看 所有内置主题。 您可以将 Theme
对象传递到 themes
数组中来加载自定义主题。
ts
import { } from 'shikiji'
const = {
: 'my-theme',
: [
{
: ['comment'],
: {
: '#888'
}
},
// ...
]
}
const = await ({
: []
})
const = `console.log('hello')`
const = .(, {
: 'javascript',
: 'my-theme'
})
您也可以在创建高亮器后加载主题。
ts
import { } from 'shikiji'
// Load the theme object from a file, a network request, or anywhere
const = .(.('my-theme.json', 'utf8'))
const = await ()
await .() // <--
const = `console.log('hello')`
const = .(, {
: 'javascript',
: 'my-theme'
})
主题必须是一个 TextMate 语法 JSON 主题对象。例如,它应该看起来像这样。