|
1 |
| -import type { BundledLanguage } from 'shiki/types'; |
| 1 | +import { createCssVariablesTheme } from 'shiki/core'; |
| 2 | +import type { BundledLanguage, ThemeRegistration } from 'shiki/types'; |
2 | 3 |
|
3 | 4 | export type ShikiLang = BundledLanguage | 'text';
|
4 | 5 | export type ShikiTheme = (typeof SHIKI_THEMES)[number];
|
5 | 6 |
|
| 7 | +export const SHIKI_CSS_THEME = createCssVariablesTheme({ |
| 8 | + name: 'css-variables', |
| 9 | + variablePrefix: '--mint-', |
| 10 | + variableDefaults: { |
| 11 | + 'color-text': '#171717', |
| 12 | + 'color-background': 'transparent', |
| 13 | + 'token-constant': '#171717', |
| 14 | + 'token-string': '#297a3a', |
| 15 | + 'token-comment': '#666666', |
| 16 | + 'token-keyword': '#bd2864', |
| 17 | + 'token-parameter': '#a35200', |
| 18 | + 'token-function': '#0068d6', |
| 19 | + 'token-string-expression': '#297a3a', |
| 20 | + 'token-punctuation': '#171717', |
| 21 | + 'token-link': '#297a3a', |
| 22 | + |
| 23 | + 'ansi-black': '#000000', |
| 24 | + 'ansi-black-dim': '#00000080', |
| 25 | + 'ansi-red': '#bb0000', |
| 26 | + 'ansi-red-dim': '#bb000080', |
| 27 | + 'ansi-green': '#00bb00', |
| 28 | + 'ansi-green-dim': '#00bb0080', |
| 29 | + 'ansi-yellow': '#bbbb00', |
| 30 | + 'ansi-yellow-dim': '#bbbb0080', |
| 31 | + 'ansi-blue': '#0000bb', |
| 32 | + 'ansi-blue-dim': '#0000bb80', |
| 33 | + 'ansi-magenta': '#ff00ff', |
| 34 | + 'ansi-magenta-dim': '#ff00ff80', |
| 35 | + 'ansi-cyan': '#00bbbb', |
| 36 | + 'ansi-cyan-dim': '#00bbbb80', |
| 37 | + 'ansi-white': '#eeeeee', |
| 38 | + 'ansi-white-dim': '#eeeeee80', |
| 39 | + 'ansi-bright-black': '#555555', |
| 40 | + 'ansi-bright-black-dim': '#55555580', |
| 41 | + 'ansi-bright-red': '#ff5555', |
| 42 | + 'ansi-bright-red-dim': '#ff555580', |
| 43 | + 'ansi-bright-green': '#00ff00', |
| 44 | + 'ansi-bright-green-dim': '#00ff0080', |
| 45 | + 'ansi-bright-yellow': '#ffff55', |
| 46 | + 'ansi-bright-yellow-dim': '#ffff5580', |
| 47 | + 'ansi-bright-blue': '#5555ff', |
| 48 | + 'ansi-bright-blue-dim': '#5555ff80', |
| 49 | + 'ansi-bright-magenta': '#ff55ff', |
| 50 | + 'ansi-bright-magenta-dim': '#ff55ff80', |
| 51 | + 'ansi-bright-cyan': '#55ffff', |
| 52 | + 'ansi-bright-cyan-dim': '#55ffff80', |
| 53 | + 'ansi-bright-white': '#ffffff', |
| 54 | + 'ansi-bright-white-dim': '#ffffff80', |
| 55 | + }, |
| 56 | + fontStyle: true, |
| 57 | +}); |
| 58 | + |
6 | 59 | export const DEFAULT_LANG = 'text' as const;
|
7 | 60 | export const DEFAULT_DARK_THEME: ShikiTheme = 'dark-plus' as const;
|
8 | 61 | export const DEFAULT_LIGHT_THEME: ShikiTheme = 'github-light-default' as const;
|
9 |
| -export const DEFAULT_THEMES: [ShikiTheme, ShikiTheme] = [ |
| 62 | +export const DEFAULT_THEMES: [ShikiTheme, ShikiTheme, ThemeRegistration] = [ |
10 | 63 | DEFAULT_LIGHT_THEME,
|
11 | 64 | DEFAULT_DARK_THEME,
|
| 65 | + SHIKI_CSS_THEME, |
12 | 66 | ] as const;
|
13 | 67 |
|
14 | 68 | export const shikiColorReplacements: Partial<Record<ShikiTheme, string | Record<string, string>>> =
|
@@ -403,4 +457,6 @@ export const SHIKI_THEMES = [
|
403 | 457 | 'vitesse-black',
|
404 | 458 | 'vitesse-dark',
|
405 | 459 | 'vitesse-light',
|
| 460 | + |
| 461 | + 'css-variables', // for users who want to use custom CSS to style their code blocks |
406 | 462 | ] as const;
|
0 commit comments