~james/core

core/blog/src/tangled.theme.mjs -rw-r--r-- 2.6 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/** @returns {import("shiki").ThemeRegistration} */
function theme(name, type, p) {
	return {
		name,
		type,
		colors: {
			"editor.background": p.background,
			"editor.foreground": p.foreground,
		},
		tokenColors: [
			{ settings: { foreground: p.foreground } },
			{ scope: ["comment", "punctuation.definition.comment"], settings: { foreground: p.comment } },
			{ scope: ["keyword", "storage", "keyword.control", "storage.type", "storage.modifier"], settings: { foreground: p.magenta } },
			{ scope: ["keyword.operator", "punctuation"], settings: { foreground: p.punctuation } },
			{ scope: ["string", "string.template", "markup.inline.raw"], settings: { foreground: p.green } },
			{ scope: ["string.regexp", "constant.character.escape"], settings: { foreground: p.cyan } },
			{ scope: ["constant.numeric", "constant.language", "constant.other", "support.constant", "variable.other.constant"], settings: { foreground: p.yellow } },
			{ scope: ["entity.name.function", "support.function", "meta.function-call"], settings: { foreground: p.blue } },
			{ scope: ["entity.name.type", "entity.name.class", "support.type", "support.class", "entity.other.inherited-class"], settings: { foreground: p.cyan } },
			{ scope: ["entity.name.tag", "variable.language"], settings: { foreground: p.red } },
			{ scope: ["entity.other.attribute-name", "support.type.property-name", "meta.object-literal.key"], settings: { foreground: p.yellow } },
			{ scope: ["markup.heading", "entity.name.section"], settings: { foreground: p.blue } },
			{ scope: ["markup.bold"], settings: { fontStyle: "bold" } },
			{ scope: ["markup.italic"], settings: { fontStyle: "italic" } },
			{ scope: ["markup.underline.link", "string.other.link"], settings: { foreground: p.cyan } },
			{ scope: ["markup.inserted", "punctuation.definition.inserted"], settings: { foreground: p.green } },
			{ scope: ["markup.deleted", "punctuation.definition.deleted"], settings: { foreground: p.red } },
			{ scope: ["markup.changed", "punctuation.definition.changed"], settings: { foreground: p.yellow } },
			{ scope: ["invalid"], settings: { foreground: p.red } },
		],
	};
}

export const tangledDark = theme("tangled-dark", "dark", {
	background: "#0a0a0a",
	foreground: "#D1D5DB",
	comment: "#9f9fb3",
	punctuation: "#9a9ab3",
	red: "#d45555",
	green: "#68b37a",
	yellow: "#cc7143",
	blue: "#897ee6",
	magenta: "#b178bf",
	cyan: "#8cc2c2",
});

export const tangledLight = theme("tangled-light", "light", {
	background: "#f5f5f5",
	foreground: "#1F2937",
	comment: "#6e6e8b",
	punctuation: "#6d6d91",
	red: "#ba4949",
	green: "#2b7f4b",
	yellow: "#a65d42",
	blue: "#6161b8",
	magenta: "#8945c4",
	cyan: "#387b76",
});