Skip to content

Commit afdb440

Browse files
authored
Apply theme change only for ansi highlights (#1718)
* Apply vitesse-dark theme only for ansi code blocks * Switch to one-dark-pro
1 parent 8b202cb commit afdb440

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.vuepress/config.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,29 @@ export default defineUserConfig({
192192
},
193193
}),
194194
shikiPlugin({
195-
theme: 'dark-plus',
195+
themes: {
196+
dark: 'dark-plus',
197+
onedarkpro: 'one-dark-pro', // pre-load one-dark-pro for ansi code blocks
198+
},
196199
lineNumbers: 10,
200+
transformers: [
201+
// use one-dark-pro theme for ansi code blocks
202+
{
203+
preprocess(code, options) {
204+
if (options.lang == 'ansi') {
205+
this.options.defaultColor = 'onedarkpro';
206+
// this doesn't work at the top-level for some reason
207+
this.options.colorReplacements = {
208+
// make one-dark-pro background color the same as dark-plus
209+
'#282c34': '#1e1e1e',
210+
// HACK: change color of comments, since nu-highlight can't highlight them
211+
'#abb2bf': '#80858f',
212+
};
213+
}
214+
return code;
215+
},
216+
},
217+
],
197218
langs: [
198219
'csv',
199220
'nushell',

0 commit comments

Comments
 (0)