Skip to content

The only tool you need to know what is happening and how to fix it.

7.5 KB
Raw Blame
import type { RawThemeSetting, ThemeRegistrationRaw } from "shiki";

// GitHub Dark Default token colors, copied from shiki's bundled github-dark-default theme. The two
// Go rules at the end paint builtin type names and numeric-literal prefixes with the constant blue,
// so `byte` and `0x03` read as one value; the grammar alone would paint them keyword red.
const tokenColors: RawThemeSetting[] = [
  {
    settings: {
      foreground: "#e6edf3",
      background: "#00000000"
    }
  },
  {
    scope: [
      "comment",
      "punctuation.definition.comment",
      "string.comment"
    ],
    settings: {
      foreground: "#8b949e"
    }
  },
  {
    scope: [
      "constant.other.placeholder",
      "constant.character"
    ],
    settings: {
      foreground: "#ff7b72"
    }
  },
  {
    scope: [
      "constant",
      "entity.name.constant",
      "variable.other.constant",
      "variable.other.enummember",
      "variable.language",
      "entity"
    ],
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: [
      "entity.name",
      "meta.export.default",
      "meta.definition.variable"
    ],
    settings: {
      foreground: "#ffa657"
    }
  },
  {
    scope: [
      "variable.parameter.function",
      "meta.jsx.children",
      "meta.block",
      "meta.tag.attributes",
      "entity.name.constant",
      "meta.object.member",
      "meta.embedded.expression"
    ],
    settings: {
      foreground: "#e6edf3"
    }
  },
  {
    scope: "entity.name.function",
    settings: {
      foreground: "#d2a8ff"
    }
  },
  {
    scope: [
      "entity.name.tag",
      "support.class.component"
    ],
    settings: {
      foreground: "#7ee787"
    }
  },
  {
    scope: "keyword",
    settings: {
      foreground: "#ff7b72"
    }
  },
  {
    scope: [
      "storage",
      "storage.type"
    ],
    settings: {
      foreground: "#ff7b72"
    }
  },
  {
    scope: [
      "storage.modifier.package",
      "storage.modifier.import",
      "storage.type.java"
    ],
    settings: {
      foreground: "#e6edf3"
    }
  },
  {
    scope: [
      "string",
      "string punctuation.section.embedded source"
    ],
    settings: {
      foreground: "#a5d6ff"
    }
  },
  {
    scope: "support",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "meta.property-name",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "variable",
    settings: {
      foreground: "#ffa657"
    }
  },
  {
    scope: "variable.other",
    settings: {
      foreground: "#e6edf3"
    }
  },
  {
    scope: "invalid.broken",
    settings: {
      fontStyle: "italic",
      foreground: "#ffa198"
    }
  },
  {
    scope: "invalid.deprecated",
    settings: {
      fontStyle: "italic",
      foreground: "#ffa198"
    }
  },
  {
    scope: "invalid.illegal",
    settings: {
      fontStyle: "italic",
      foreground: "#ffa198"
    }
  },
  {
    scope: "invalid.unimplemented",
    settings: {
      fontStyle: "italic",
      foreground: "#ffa198"
    }
  },
  {
    scope: "message.error",
    settings: {
      foreground: "#ffa198"
    }
  },
  {
    scope: "string variable",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: [
      "source.regexp",
      "string.regexp"
    ],
    settings: {
      foreground: "#a5d6ff"
    }
  },
  {
    scope: [
      "string.regexp.character-class",
      "string.regexp constant.character.escape",
      "string.regexp source.ruby.embedded",
      "string.regexp string.regexp.arbitrary-repitition"
    ],
    settings: {
      foreground: "#a5d6ff"
    }
  },
  {
    scope: "string.regexp constant.character.escape",
    settings: {
      fontStyle: "bold",
      foreground: "#7ee787"
    }
  },
  {
    scope: "support.constant",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "support.variable",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "support.type.property-name.json",
    settings: {
      foreground: "#7ee787"
    }
  },
  {
    scope: "meta.module-reference",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "punctuation.definition.list.begin.markdown",
    settings: {
      foreground: "#ffa657"
    }
  },
  {
    scope: [
      "markup.heading",
      "markup.heading entity.name"
    ],
    settings: {
      fontStyle: "bold",
      foreground: "#79c0ff"
    }
  },
  {
    scope: "markup.quote",
    settings: {
      foreground: "#7ee787"
    }
  },
  {
    scope: "markup.italic",
    settings: {
      fontStyle: "italic",
      foreground: "#e6edf3"
    }
  },
  {
    scope: "markup.bold",
    settings: {
      fontStyle: "bold",
      foreground: "#e6edf3"
    }
  },
  {
    scope: [
      "markup.underline"
    ],
    settings: {
      fontStyle: "underline"
    }
  },
  {
    scope: [
      "markup.strikethrough"
    ],
    settings: {
      fontStyle: "strikethrough"
    }
  },
  {
    scope: "markup.inline.raw",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: [
      "markup.deleted",
      "meta.diff.header.from-file",
      "punctuation.definition.deleted"
    ],
    settings: {
      background: "#490202",
      foreground: "#ffa198"
    }
  },
  {
    scope: [
      "punctuation.section.embedded"
    ],
    settings: {
      foreground: "#ff7b72"
    }
  },
  {
    scope: [
      "markup.inserted",
      "meta.diff.header.to-file",
      "punctuation.definition.inserted"
    ],
    settings: {
      background: "#04260f",
      foreground: "#7ee787"
    }
  },
  {
    scope: [
      "markup.changed",
      "punctuation.definition.changed"
    ],
    settings: {
      background: "#5a1e02",
      foreground: "#ffa657"
    }
  },
  {
    scope: [
      "markup.ignored",
      "markup.untracked"
    ],
    settings: {
      background: "#79c0ff",
      foreground: "#161b22"
    }
  },
  {
    scope: "meta.diff.range",
    settings: {
      fontStyle: "bold",
      foreground: "#d2a8ff"
    }
  },
  {
    scope: "meta.diff.header",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: "meta.separator",
    settings: {
      fontStyle: "bold",
      foreground: "#79c0ff"
    }
  },
  {
    scope: "meta.output",
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: [
      "brackethighlighter.tag",
      "brackethighlighter.curly",
      "brackethighlighter.round",
      "brackethighlighter.square",
      "brackethighlighter.angle",
      "brackethighlighter.quote"
    ],
    settings: {
      foreground: "#8b949e"
    }
  },
  {
    scope: "brackethighlighter.unmatched",
    settings: {
      foreground: "#ffa198"
    }
  },
  {
    scope: [
      "constant.other.reference.link",
      "string.other.link"
    ],
    settings: {
      foreground: "#a5d6ff"
    }
  },
  {
    scope: [
      "storage.type.boolean.go",
      "storage.type.byte.go",
      "storage.type.error.go",
      "storage.type.numeric.go",
      "storage.type.rune.go",
      "storage.type.string.go",
      "storage.type.uintptr.go"
    ],
    settings: {
      foreground: "#79c0ff"
    }
  },
  {
    scope: [
      "keyword.other.unit.binary.go",
      "keyword.other.unit.exponent.decimal.go",
      "keyword.other.unit.exponent.hexadecimal.go",
      "keyword.other.unit.hexadecimal.go",
      "keyword.other.unit.imaginary.go",
      "keyword.other.unit.octal.go"
    ],
    settings: {
      foreground: "#79c0ff"
    }
  }
];

export const githubDarkShiki: ThemeRegistrationRaw = {
  name: "traceway-github-dark",
  type: "dark",
  colors: {
    "editor.background": "#00000000",
    "editor.foreground": "#e6edf3",
  },
  settings: tokenColors,
  tokenColors,
};