Skip to content

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

feat: better color palette

narrow-adventure99147c1d8c8e
diff --git a/website/app/blog/[slug]/page.tsx b/website/app/blog/[slug]/page.tsx
index 49818a11..d206e432 100644
--- a/website/app/blog/[slug]/page.tsx
+++ b/website/app/blog/[slug]/page.tsx
@@ -2,7 +2,7 @@ import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { BlogArticle } from "@/components/blog-article";
import { getPostsByCategory, getPostBySlug, postMetadata } from "@/lib/blog";
-import { vscodeDarkShiki } from "@/lib/shiki-theme-vscode";
+import { githubDarkShiki } from "@/lib/shiki-theme-github";
type Params = { slug: string };
@@ -37,7 +37,7 @@ export default async function BlogPostPage({
backHref="/blog"
eyebrow="Engineering"
showSubscribe
- codeTheme={vscodeDarkShiki}
+ codeTheme={githubDarkShiki}
/>
);
}
diff --git a/website/lib/shiki-theme-github.ts b/website/lib/shiki-theme-github.ts
new file mode 100644
index 00000000..1fdcc1cf
--- /dev/null
+++ b/website/lib/shiki-theme-github.ts
@@ -0,0 +1,433 @@
+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,
+};
diff --git a/website/lib/shiki-theme-vscode.ts b/website/lib/shiki-theme-vscode.ts
deleted file mode 100644
index d9d7b6b5..00000000
--- a/website/lib/shiki-theme-vscode.ts
+++ /dev/null
@@ -1,586 +0,0 @@
-import type { RawThemeSetting, ThemeRegistrationRaw } from "shiki";
-
-// VS Code's Dark+ token colors, copied from shiki's bundled dark-plus theme. The last rule mirrors
-// the Go extension's semantic highlighting, which paints every Go keyword with the control-keyword
-// purple; the static grammar alone would leave func/type/struct/map blue.
-const tokenColors: RawThemeSetting[] = [
- {
- settings: {
- foreground: "#D4D4D4",
- background: "#00000000"
- }
- },
- {
- scope: [
- "meta.embedded",
- "source.groovy.embedded",
- "string meta.image.inline.markdown",
- "variable.legacy.builtin.python"
- ],
- settings: {
- foreground: "#D4D4D4"
- }
- },
- {
- scope: "emphasis",
- settings: {
- fontStyle: "italic"
- }
- },
- {
- scope: "strong",
- settings: {
- fontStyle: "bold"
- }
- },
- {
- scope: "header",
- settings: {
- foreground: "#000080"
- }
- },
- {
- scope: "comment",
- settings: {
- foreground: "#6A9955"
- }
- },
- {
- scope: "constant.language",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "constant.numeric",
- "variable.other.enummember",
- "keyword.operator.plus.exponent",
- "keyword.operator.minus.exponent"
- ],
- settings: {
- foreground: "#b5cea8"
- }
- },
- {
- scope: "constant.regexp",
- settings: {
- foreground: "#646695"
- }
- },
- {
- scope: "entity.name.tag",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "entity.name.tag.css",
- "entity.name.tag.less"
- ],
- settings: {
- foreground: "#d7ba7d"
- }
- },
- {
- scope: "entity.other.attribute-name",
- settings: {
- foreground: "#9cdcfe"
- }
- },
- {
- scope: [
- "entity.other.attribute-name.class.css",
- "source.css entity.other.attribute-name.class",
- "entity.other.attribute-name.id.css",
- "entity.other.attribute-name.parent-selector.css",
- "entity.other.attribute-name.parent.less",
- "source.css entity.other.attribute-name.pseudo-class",
- "entity.other.attribute-name.pseudo-element.css",
- "source.css.less entity.other.attribute-name.id",
- "entity.other.attribute-name.scss"
- ],
- settings: {
- foreground: "#d7ba7d"
- }
- },
- {
- scope: "invalid",
- settings: {
- foreground: "#f44747"
- }
- },
- {
- scope: "markup.underline",
- settings: {
- fontStyle: "underline"
- }
- },
- {
- scope: "markup.bold",
- settings: {
- fontStyle: "bold",
- foreground: "#569cd6"
- }
- },
- {
- scope: "markup.heading",
- settings: {
- fontStyle: "bold",
- foreground: "#569cd6"
- }
- },
- {
- scope: "markup.italic",
- settings: {
- fontStyle: "italic"
- }
- },
- {
- scope: "markup.strikethrough",
- settings: {
- fontStyle: "strikethrough"
- }
- },
- {
- scope: "markup.inserted",
- settings: {
- foreground: "#b5cea8"
- }
- },
- {
- scope: "markup.deleted",
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "markup.changed",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "punctuation.definition.quote.begin.markdown",
- settings: {
- foreground: "#6A9955"
- }
- },
- {
- scope: "punctuation.definition.list.begin.markdown",
- settings: {
- foreground: "#6796e6"
- }
- },
- {
- scope: "markup.inline.raw",
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "punctuation.definition.tag",
- settings: {
- foreground: "#808080"
- }
- },
- {
- scope: [
- "meta.preprocessor",
- "entity.name.function.preprocessor"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "meta.preprocessor.string",
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "meta.preprocessor.numeric",
- settings: {
- foreground: "#b5cea8"
- }
- },
- {
- scope: "meta.structure.dictionary.key.python",
- settings: {
- foreground: "#9cdcfe"
- }
- },
- {
- scope: "meta.diff.header",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "storage",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "storage.type",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "storage.modifier",
- "keyword.operator.noexcept"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "string",
- "meta.embedded.assembly"
- ],
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "string.tag",
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "string.value",
- settings: {
- foreground: "#ce9178"
- }
- },
- {
- scope: "string.regexp",
- settings: {
- foreground: "#d16969"
- }
- },
- {
- scope: [
- "punctuation.definition.template-expression.begin",
- "punctuation.definition.template-expression.end",
- "punctuation.section.embedded"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "meta.template.expression"
- ],
- settings: {
- foreground: "#d4d4d4"
- }
- },
- {
- scope: [
- "support.type.vendored.property-name",
- "support.type.property-name",
- "source.css variable",
- "source.coffee.embedded"
- ],
- settings: {
- foreground: "#9cdcfe"
- }
- },
- {
- scope: "keyword",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "keyword.control",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "keyword.operator",
- settings: {
- foreground: "#d4d4d4"
- }
- },
- {
- scope: [
- "keyword.operator.new",
- "keyword.operator.expression",
- "keyword.operator.cast",
- "keyword.operator.sizeof",
- "keyword.operator.alignof",
- "keyword.operator.typeid",
- "keyword.operator.alignas",
- "keyword.operator.instanceof",
- "keyword.operator.logical.python",
- "keyword.operator.wordlike"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "keyword.other.unit",
- settings: {
- foreground: "#b5cea8"
- }
- },
- {
- scope: [
- "punctuation.section.embedded.begin.php",
- "punctuation.section.embedded.end.php"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "support.function.git-rebase",
- settings: {
- foreground: "#9cdcfe"
- }
- },
- {
- scope: "constant.sha.git-rebase",
- settings: {
- foreground: "#b5cea8"
- }
- },
- {
- scope: [
- "storage.modifier.import.java",
- "variable.language.wildcard.java",
- "storage.modifier.package.java"
- ],
- settings: {
- foreground: "#d4d4d4"
- }
- },
- {
- scope: "variable.language",
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: [
- "entity.name.function",
- "support.function",
- "support.constant.handlebars",
- "source.powershell variable.other.member",
- "entity.name.operator.custom-literal"
- ],
- settings: {
- foreground: "#DCDCAA"
- }
- },
- {
- scope: [
- "support.class",
- "support.type",
- "entity.name.type",
- "entity.name.namespace",
- "entity.other.attribute",
- "entity.name.scope-resolution",
- "entity.name.class",
- "storage.type.numeric.go",
- "storage.type.byte.go",
- "storage.type.boolean.go",
- "storage.type.string.go",
- "storage.type.uintptr.go",
- "storage.type.error.go",
- "storage.type.rune.go",
- "storage.type.cs",
- "storage.type.generic.cs",
- "storage.type.modifier.cs",
- "storage.type.variable.cs",
- "storage.type.annotation.java",
- "storage.type.generic.java",
- "storage.type.java",
- "storage.type.object.array.java",
- "storage.type.primitive.array.java",
- "storage.type.primitive.java",
- "storage.type.token.java",
- "storage.type.groovy",
- "storage.type.annotation.groovy",
- "storage.type.parameters.groovy",
- "storage.type.generic.groovy",
- "storage.type.object.array.groovy",
- "storage.type.primitive.array.groovy",
- "storage.type.primitive.groovy"
- ],
- settings: {
- foreground: "#4EC9B0"
- }
- },
- {
- scope: [
- "meta.type.cast.expr",
- "meta.type.new.expr",
- "support.constant.math",
- "support.constant.dom",
- "support.constant.json",
- "entity.other.inherited-class",
- "punctuation.separator.namespace.ruby"
- ],
- settings: {
- foreground: "#4EC9B0"
- }
- },
- {
- scope: [
- "keyword.control",
- "source.cpp keyword.operator.new",
- "keyword.operator.delete",
- "keyword.other.using",
- "keyword.other.directive.using",
- "keyword.other.operator",
- "entity.name.operator"
- ],
- settings: {
- foreground: "#C586C0"
- }
- },
- {
- scope: [
- "variable",
- "meta.definition.variable.name",
- "support.variable",
- "entity.name.variable",
- "constant.other.placeholder"
- ],
- settings: {
- foreground: "#9CDCFE"
- }
- },
- {
- scope: [
- "variable.other.constant",
- "variable.other.enummember"
- ],
- settings: {
- foreground: "#4FC1FF"
- }
- },
- {
- scope: [
- "meta.object-literal.key"
- ],
- settings: {
- foreground: "#9CDCFE"
- }
- },
- {
- scope: [
- "support.constant.property-value",
- "support.constant.font-name",
- "support.constant.media-type",
- "support.constant.media",
- "constant.other.color.rgb-value",
- "constant.other.rgb-value",
- "support.constant.color"
- ],
- settings: {
- foreground: "#CE9178"
- }
- },
- {
- scope: [
- "punctuation.definition.group.regexp",
- "punctuation.definition.group.assertion.regexp",
- "punctuation.definition.character-class.regexp",
- "punctuation.character.set.begin.regexp",
- "punctuation.character.set.end.regexp",
- "keyword.operator.negation.regexp",
- "support.other.parenthesis.regexp"
- ],
- settings: {
- foreground: "#CE9178"
- }
- },
- {
- scope: [
- "constant.character.character-class.regexp",
- "constant.other.character-class.set.regexp",
- "constant.other.character-class.regexp",
- "constant.character.set.regexp"
- ],
- settings: {
- foreground: "#d16969"
- }
- },
- {
- scope: [
- "keyword.operator.or.regexp",
- "keyword.control.anchor.regexp"
- ],
- settings: {
- foreground: "#DCDCAA"
- }
- },
- {
- scope: "keyword.operator.quantifier.regexp",
- settings: {
- foreground: "#d7ba7d"
- }
- },
- {
- scope: [
- "constant.character",
- "constant.other.option"
- ],
- settings: {
- foreground: "#569cd6"
- }
- },
- {
- scope: "constant.character.escape",
- settings: {
- foreground: "#d7ba7d"
- }
- },
- {
- scope: "entity.name.label",
- settings: {
- foreground: "#C8C8C8"
- }
- },
- {
- scope: [
- "keyword.package.go",
- "keyword.function.go",
- "keyword.type.go",
- "keyword.struct.go",
- "keyword.interface.go",
- "keyword.map.go",
- "keyword.channel.go",
- "keyword.var.go",
- "keyword.const.go"
- ],
- settings: {
- foreground: "#C586C0"
- }
- }
-];
-
-export const vscodeDarkShiki: ThemeRegistrationRaw = {
- name: "vscode-dark-plus",
- type: "dark",
- colors: {
- "editor.background": "#00000000",
- "editor.foreground": "#D4D4D4",
- },
- settings: tokenColors,
- tokenColors,
-};