|
| 1 | +import type { ThemeRegistrationRaw } from 'shiki'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Custom Tokyo Night dark theme for Shiki — matches the playground's CodeMirror colors. |
| 5 | + * The built-in shiki tokyo-night uses slightly different colors for some tokens. |
| 6 | + */ |
| 7 | +export const tokyoNightDark: ThemeRegistrationRaw = { |
| 8 | + name: 'tokyo-night-custom', |
| 9 | + type: 'dark', |
| 10 | + settings: [ |
| 11 | + // Global defaults |
| 12 | + { settings: { foreground: '#c0caf5', background: '#1a1b26' } }, |
| 13 | + |
| 14 | + // Comments |
| 15 | + { scope: ['comment', 'punctuation.definition.comment'], settings: { foreground: '#565f89' } }, |
| 16 | + |
| 17 | + // Strings |
| 18 | + { scope: ['string', 'string.quoted', 'string.template'], settings: { foreground: '#9ece6a' } }, |
| 19 | + |
| 20 | + // Numbers |
| 21 | + { scope: ['constant.numeric', 'constant.numeric.decimal', 'constant.numeric.integer', 'constant.numeric.float', 'constant.numeric.hex'], settings: { foreground: '#ff9e64' } }, |
| 22 | + |
| 23 | + // Booleans |
| 24 | + { scope: ['constant.language.boolean', 'constant.language'], settings: { foreground: '#ff9e64' } }, |
| 25 | + { scope: ['constant.language.null', 'constant.language.undefined'], settings: { foreground: '#565f89' } }, |
| 26 | + |
| 27 | + // Keywords |
| 28 | + { scope: ['keyword', 'storage.type', 'storage.modifier', 'keyword.control', 'keyword.control.import', 'keyword.control.from', 'keyword.control.export', 'keyword.control.default', 'keyword.control.return', 'keyword.control.conditional', 'keyword.control.loop'], settings: { foreground: '#bb9af7', fontStyle: 'bold' } }, |
| 29 | + |
| 30 | + // Operators |
| 31 | + { scope: ['keyword.operator', 'keyword.operator.assignment', 'keyword.operator.comparison', 'keyword.operator.arithmetic', 'keyword.operator.logical', 'keyword.operator.ternary', 'keyword.operator.spread', 'keyword.operator.type.annotation'], settings: { foreground: '#89ddff' } }, |
| 32 | + |
| 33 | + // Functions |
| 34 | + { scope: ['entity.name.function', 'support.function', 'meta.function-call entity.name.function', 'variable.function'], settings: { foreground: '#7aa2f7' } }, |
| 35 | + |
| 36 | + // Types / classes |
| 37 | + { scope: ['entity.name.type', 'support.type', 'support.class', 'entity.name.class', 'support.type.builtin', 'keyword.type'], settings: { foreground: '#7aa2f7' } }, |
| 38 | + |
| 39 | + // Variables — bright green like the playground |
| 40 | + { scope: ['variable', 'variable.other.readwrite', 'entity.name.variable', 'variable.parameter'], settings: { foreground: '#c0caf5' } }, |
| 41 | + |
| 42 | + // Properties — teal |
| 43 | + { scope: ['variable.other.property', 'support.variable.property', 'meta.object-literal.key', 'variable.other.object.property', 'entity.name.tag.yaml'], settings: { foreground: '#73daca' } }, |
| 44 | + |
| 45 | + // Punctuation — brackets, braces, parens |
| 46 | + { scope: ['punctuation.definition.block', 'punctuation.definition.parameters', 'punctuation.section', 'meta.brace.round', 'meta.brace.curly', 'meta.brace.square', 'punctuation.definition.binding-pattern'], settings: { foreground: '#698098' } }, |
| 47 | + |
| 48 | + // Punctuation — separators, commas, semicolons, dots |
| 49 | + { scope: ['punctuation.separator', 'punctuation.terminator', 'punctuation.accessor', 'punctuation.separator.comma', 'punctuation.definition.string'], settings: { foreground: '#89ddff' } }, |
| 50 | + |
| 51 | + // JSX/HTML tags — red/coral |
| 52 | + { scope: ['entity.name.tag', 'support.class.component'], settings: { foreground: '#f7768e' } }, |
| 53 | + |
| 54 | + // JSX/HTML attributes — orange |
| 55 | + { scope: ['entity.other.attribute-name'], settings: { foreground: '#ff9e64' } }, |
| 56 | + |
| 57 | + // Regex |
| 58 | + { scope: ['string.regexp'], settings: { foreground: '#b4f9f8' } }, |
| 59 | + |
| 60 | + // Special — decorators |
| 61 | + { scope: ['meta.decorator', 'punctuation.decorator'], settings: { foreground: '#ff9e64' } }, |
| 62 | + |
| 63 | + // SQL keywords — cyan blue like the playground |
| 64 | + { scope: ['keyword.other.DML', 'keyword.other.DDL', 'keyword.other.sql', 'keyword.other.create', 'keyword.other.data-integrity'], settings: { foreground: '#bb9af7', fontStyle: 'bold' } }, |
| 65 | + |
| 66 | + // SQL functions |
| 67 | + { scope: ['support.function.aggregate', 'support.function.scalar', 'support.function.string'], settings: { foreground: '#7aa2f7' } }, |
| 68 | + |
| 69 | + // Bash/shell |
| 70 | + { scope: ['keyword.control.shell', 'support.function.builtin.shell', 'entity.name.command.shell'], settings: { foreground: '#7aa2f7' } }, |
| 71 | + { scope: ['string.unquoted.argument.shell', 'variable.other.normal.shell'], settings: { foreground: '#c0caf5' } }, |
| 72 | + |
| 73 | + // Go |
| 74 | + { scope: ['entity.name.package.go', 'entity.name.import.go'], settings: { foreground: '#c0caf5' } }, |
| 75 | + { scope: ['keyword.function.go', 'keyword.var.go', 'keyword.const.go', 'keyword.type.go', 'keyword.import.go', 'keyword.package.go'], settings: { foreground: '#bb9af7', fontStyle: 'bold' } }, |
| 76 | + |
| 77 | + // Markdown |
| 78 | + { scope: ['markup.heading'], settings: { foreground: '#7aa2f7', fontStyle: 'bold' } }, |
| 79 | + { scope: ['markup.bold'], settings: { fontStyle: 'bold' } }, |
| 80 | + { scope: ['markup.italic'], settings: { fontStyle: 'italic' } }, |
| 81 | + { scope: ['markup.inline.raw'], settings: { foreground: '#73daca' } }, |
| 82 | + ], |
| 83 | +}; |
0 commit comments