Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
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
85 changes: 85 additions & 0 deletions packages/catppuccin-vsc/src/theme/tokens/haskell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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: ["meta.declaration.data constant.other", "constant.other"],
settings: { foreground: palette.blue },
// like functions (capitalized -> still visually distinct)
},
{
name: "type constructors",
scope: ["storage.type.haskell"],
settings: {
foreground: palette.yellow,
fontStyle: "italic",
},
},
{
name: "typeclasses",
scope: ["entity.name.type.class"],
settings: {
foreground: palette.yellow,
fontStyle: "",
},
},
Comment on lines +28 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in this file should be specific to haskell in the textmate scopes. This generic scope will affect other languages outside of haskell and should be carefully introduced in the index.ts file if need be.

I'd like to see this removed in favour of a more specific scope.

{
name: "module name",
scope: "meta.declaration.module.haskell entity.name.namespace.haskell",
settings: {
foreground: palette.peach, // as in Rust
},
},
{
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 },
},
Copy link
Contributor

@sgoudham sgoudham Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in this file should be specific to haskell in the textmate scopes. These generic scope will affect other languages outside of haskell and should be carefully introduced in the index.ts file if need be.

I'd like to see this removed in favour of a more specific scope.

{
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