Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/catppuccin-vsc/src/theme/semanticTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const getSemanticTokens = (context: ThemeContext): SemanticTokens => {
"type.defaultLibrary:go": { foreground: palette.mauve },
"variable.readonly.defaultLibrary:go": { foreground: palette.mauve },

// Haskell:
"enumMember:haskell": { foreground: palette.blue }, // data constructor
"enum:haskell": { foreground: palette.yellow }, // type constructor
"class:haskell": { foreground: palette.yellow, fontStyle: "" }, // typeclass
"interface:haskell": { foreground: palette.pink }, // type family

// TOML syntax
tomlArrayKey: { foreground: palette.blue, fontStyle: "" },
tomlTableKey: { foreground: palette.blue, fontStyle: "" },
Expand Down
94 changes: 94 additions & 0 deletions packages/catppuccin-vsc/src/theme/tokens/haskell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import type { TextmateColors, ThemeContext } from "@/types";

const tokens = (context: ThemeContext): TextmateColors => {
const { palette } = context;

/*
should preferrably appear visually distinct:
- data constructors -> use blue
- type constructors -> use yellow+italic
- typeclasses -> use yellow
*/

return [
{
name: "data constructors",
scope: [
"variable.other.enummember",
"meta.declaration.data constant.other",
"constant.other",
],
settings: { foreground: palette.blue },
// like functions (capitalized -> still visually distinct)
},
{
name: "type constructors",
scope: ["entity.name.type", "storage.type"],
settings: {
foreground: palette.yellow,
fontStyle: "italic",
},
},
{
name: "typeclasses",
scope: ["entity.name.type.class"],
settings: {
foreground: palette.yellow,
fontStyle: "",
},
},
{
name: "module name",
scope: "meta.declaration.module.haskell entity.name.namespace.haskell",
settings: {
foreground: palette.peach, // as in Rust
},
},
{
name: "imports",
scope: ["entity.name.namespace"],
settings: { foreground: palette.rosewater },
},
{
name: "type parameters",
scope: ["entity.name.type.parameter", "variable.other.generic-type"],
settings: { foreground: palette.maroon },
},
{
name: "pragma keywords",
scope: [" keyword.other.preprocessor"],
settings: { foreground: palette.red },
},
{
name: "pragma arguments",
scope: [" keyword.other.preprocessor.extension"],
settings: { foreground: palette.peach },
},
{
name: "preprocessor directives",
scope: ["meta.preprocessor"],
settings: { foreground: palette.rosewater },
},

{
name: "type families",
scope: ["entity.name.type.interface"],
settings: { foreground: palette.pink },
// we need something distinct from typeclasses
// -> pick pink which is used for meta-variables in Rust
},
{
name: "getters in data constructors/records",
scope: ["variable.other.property", "variable.other.member"],
settings: { foreground: palette.blue },
},
{
name: "fix else keyword",
scope: ["keyword.control.else.haskell"],
settings: { foreground: palette.mauve },
// catppuccin default sets to yellow considering it preprocessor-like, which it is not for Haskell
},
];
};

export default tokens;
2 changes: 2 additions & 0 deletions packages/catppuccin-vsc/src/theme/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dotenv from "./dotenv";
import gdscript from "./gdscript";
import golang from "./golang";
import graphql from "./graphql";
import haskell from "./haskell";
import html from "./html";
import java from "./java";
import javascript from "./javascript";
Expand Down Expand Up @@ -296,6 +297,7 @@ export default function tokens(context: ThemeContext): TextmateColors {
gdscript,
golang,
graphql,
haskell,
html,
java,
javascript,
Expand Down