Skip to content

Commit

Permalink
feat: add windows terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Suya1671 committed Jun 6, 2024
1 parent ae72392 commit 2e1e0f4
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"languages": {
"TypeScript": {
"language_servers": ["deno", "!typescript-language-server", "!eslint"]
},
"TSX": {
"language_servers": ["deno", "!typescript-language-server", "!eslint"]
}
}
}
20 changes: 14 additions & 6 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { darkTheme, toHex, toVscodeTheme } from "./mod.ts"
import * as YAML from "yaml"

import {
darkTheme,
toHex,
toVscodeTheme,
toWindowsTerminalTheme,
} from "./mod.ts";
import * as YAML from "yaml";

const dark = toHex(darkTheme);

// export dark.json
Expand All @@ -11,16 +16,19 @@ await Deno.writeTextFile("build/dark.json", darkJson);
const darkYaml = YAML.stringify(dark);
await Deno.writeTextFile("build/dark-base16.yaml", darkYaml);

// export windows-terminal.json
const windowsTerminal = await toWindowsTerminalTheme(darkTheme);
await Deno.writeTextFile("build/windows-terminal.json", windowsTerminal);

// export vscode
const vscode = await toVscodeTheme(darkTheme);
await Deno.writeTextFile("build/vscode/theme.json", vscode);
// also copy over LICENSE
await Deno.copyFile("LICENSE", "build/vscode/LICENSE");
// and package
const packageOutput = await new Deno.Command("vsce", {
args: ["package"],
cwd: "build/vscode"
args: ["package"],
cwd: "build/vscode",
}).output();
console.log(new TextDecoder().decode(packageOutput.stdout));
console.error(new TextDecoder().decode(packageOutput.stderr));

23 changes: 23 additions & 0 deletions build/windows-terminal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Kleur",
"foreground": "#dadbf8",
"background": "#060613",
"cursorColor": "#dadbf8",
"selectionBackground": "#141327",
"black": "#060613",
"red": "#e6443d",
"green": "#11d770",
"yellow": "#f1a400",
"blue": "#00c0ff",
"purple": "#a89dff",
"cyan": "#00dad0",
"white": "#dadbf8",
"brightBlack": "#2b2b41",
"brightRed": "#e6443d",
"brightGreen": "#11d770",
"brightYellow": "#f1a400",
"brightBlue": "#00c0ff",
"brightPurple": "#a89dff",
"brightCyan": "#00dad0",
"brightWhite": "#a89dff"
}
3 changes: 2 additions & 1 deletion exporters/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./css.ts";
export * from "./base16.ts";
export * from "./hex.ts";
export * from "./vscode.ts";
export * from "./vscode.ts";
export * from "./windowsTerminal.ts";
25 changes: 14 additions & 11 deletions exporters/vscode.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { render } from 'mustache'
import { render } from "mustache";
import { HumanPalette } from "../palletes.ts";
import { toHex } from "./hex.ts";

export const toVscodeTheme = async (pallete: HumanPalette) => {
const hex = toHex(pallete)
const template = await Deno.readTextFile('templates/vscode.mustache')
const theme = Object.fromEntries(
Object.entries(hex).map(([key, value]) => [key + '-hex', value.replace?.("#", "")])
)
const hex = toHex(pallete);
const template = await Deno.readTextFile("templates/vscode.mustache");
const theme = Object.fromEntries(
Object.entries(hex).map(([key, value]) => [
key + "-hex",
value.replace?.("#", ""),
]),
);

return render(template, {
'scheme-name': "Kleur",
...theme
})
}
return render(template, {
"scheme-name": "Kleur",
...theme,
});
};
21 changes: 21 additions & 0 deletions exporters/windowsTerminal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { render } from "mustache";
import { HumanPalette } from "../palletes.ts";
import { toHex } from "./hex.ts";

export const toWindowsTerminalTheme = async (pallete: HumanPalette) => {
const hex = toHex(pallete);
const template = await Deno.readTextFile(
"templates/windowsTerminal.mustache",
);
const theme = Object.fromEntries(
Object.entries(hex).map(([key, value]) => [
key + "-hex",
value.replace?.("#", ""),
]),
);

return render(template, {
"scheme-name": "Kleur",
...theme,
});
};
23 changes: 23 additions & 0 deletions templates/windowsTerminal.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "{{scheme-name}}",
"foreground": "#{{base05-hex}}",
"background": "#{{base00-hex}}",
"cursorColor": "#{{base05-hex}}",
"selectionBackground": "#{{base02-hex}}",
"black": "#{{base00-hex}}",
"red": "#{{red-hex}}",
"green": "#{{green-hex}}",
"yellow": "#{{orange-hex}}",
"blue": "#{{blue-hex}}",
"purple": "#{{mauve-hex}}",
"cyan": "#{{teal-hex}}",
"white": "#{{base05-hex}}",
"brightBlack": "#{{base03-hex}}",
"brightRed": "#{{red-hex}}",
"brightGreen": "#{{green-hex}}",
"brightYellow": "#{{orange-hex}}",
"brightBlue": "#{{blue-hex}}",
"brightPurple": "#{{mauve-hex}}",
"brightCyan": "#{{teal-hex}}",
"brightWhite": "#{{base07-hex}}"
}

0 comments on commit 2e1e0f4

Please sign in to comment.