Skip to content

Commit 04b6773

Browse files
committed
Apply vitesse-dark theme only for ansi code blocks
1 parent 8b202cb commit 04b6773

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.vuepress/config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,26 @@ export default defineUserConfig({
192192
},
193193
}),
194194
shikiPlugin({
195-
theme: 'dark-plus',
195+
themes: {
196+
dark: 'dark-plus',
197+
vitessedark: 'vitesse-dark', // pre-load vitesse-dark for ansi code blocks
198+
},
196199
lineNumbers: 10,
200+
transformers: [
201+
{
202+
preprocess(code, options) {
203+
if (options.lang == 'ansi') {
204+
this.options.defaultColor = 'vitessedark';
205+
// this doesn't work at the top-level for some reason
206+
this.options.colorReplacements = {
207+
// make vitesse-dark background color the same as dark-plus
208+
'#121212': '#1e1e1e',
209+
};
210+
}
211+
return code;
212+
},
213+
},
214+
],
197215
langs: [
198216
'csv',
199217
'nushell',

0 commit comments

Comments
 (0)