|
| 1 | +import type { TextmateColors, ThemeContext } from "@/types"; |
| 2 | + |
| 3 | +const tokens = (context: ThemeContext): TextmateColors => { |
| 4 | + const { palette } = context; |
| 5 | + |
| 6 | + /* |
| 7 | + should preferrably appear visually distinct: |
| 8 | + - data constructors -> use blue |
| 9 | + - type constructors -> use yellow+italic |
| 10 | + - typeclasses -> use yellow |
| 11 | + */ |
| 12 | + |
| 13 | + return [ |
| 14 | + { |
| 15 | + name: "data constructors", |
| 16 | + scope: [ |
| 17 | + "variable.other.enummember", |
| 18 | + "meta.declaration.data constant.other", |
| 19 | + "constant.other", |
| 20 | + ], |
| 21 | + settings: { foreground: palette.blue }, |
| 22 | + // like functions (capitalized -> still visually distinct) |
| 23 | + }, |
| 24 | + { |
| 25 | + name: "type constructors", |
| 26 | + scope: ["entity.name.type", "storage.type"], |
| 27 | + settings: { |
| 28 | + foreground: palette.yellow, |
| 29 | + fontStyle: "italic", |
| 30 | + }, |
| 31 | + }, |
| 32 | + { |
| 33 | + name: "typeclasses", |
| 34 | + scope: ["entity.name.type.class"], |
| 35 | + settings: { |
| 36 | + foreground: palette.yellow, |
| 37 | + fontStyle: "", |
| 38 | + }, |
| 39 | + }, |
| 40 | + { |
| 41 | + name: "module name", |
| 42 | + scope: "meta.declaration.module.haskell entity.name.namespace.haskell", |
| 43 | + settings: { |
| 44 | + foreground: palette.peach, // as in Rust |
| 45 | + }, |
| 46 | + }, |
| 47 | + { |
| 48 | + name: "imports", |
| 49 | + scope: ["entity.name.namespace"], |
| 50 | + settings: { foreground: palette.rosewater }, |
| 51 | + }, |
| 52 | + { |
| 53 | + name: "type parameters", |
| 54 | + scope: ["entity.name.type.parameter", "variable.other.generic-type"], |
| 55 | + settings: { foreground: palette.maroon }, |
| 56 | + }, |
| 57 | + { |
| 58 | + name: "pragma keywords", |
| 59 | + scope: [" keyword.other.preprocessor"], |
| 60 | + settings: { foreground: palette.red }, |
| 61 | + }, |
| 62 | + { |
| 63 | + name: "pragma arguments", |
| 64 | + scope: [" keyword.other.preprocessor.extension"], |
| 65 | + settings: { foreground: palette.peach }, |
| 66 | + }, |
| 67 | + { |
| 68 | + name: "preprocessor directives", |
| 69 | + scope: ["meta.preprocessor"], |
| 70 | + settings: { foreground: palette.rosewater }, |
| 71 | + }, |
| 72 | + |
| 73 | + { |
| 74 | + name: "type families", |
| 75 | + scope: ["entity.name.type.interface"], |
| 76 | + settings: { foreground: palette.pink }, |
| 77 | + // we need something distinct from typeclasses |
| 78 | + // -> pick pink which is used for meta-variables in Rust |
| 79 | + }, |
| 80 | + { |
| 81 | + name: "getters in data constructors/records", |
| 82 | + scope: ["variable.other.property", "variable.other.member"], |
| 83 | + settings: { foreground: palette.blue }, |
| 84 | + }, |
| 85 | + { |
| 86 | + name: "fix else keyword", |
| 87 | + scope: ["keyword.control.else.haskell"], |
| 88 | + settings: { foreground: palette.mauve }, |
| 89 | + // catppuccin default sets to yellow considering it preprocessor-like, which it is not for Haskell |
| 90 | + }, |
| 91 | + ]; |
| 92 | +}; |
| 93 | + |
| 94 | +export default tokens; |
0 commit comments