From 6f4b85af3346e8b6d818d3238a1cae7b10f30235 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 4 Oct 2020 19:27:16 +0300 Subject: [PATCH] [colorschemes] add a generator for the VSCode terminal --- colorschemes/Makefile | 4 +-- .../out/vscode-colorCustomizations.json | 23 ++++++++++++ .../vscode-colorCustomizations.json.py | 35 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 colorschemes/out/vscode-colorCustomizations.json create mode 100755 colorschemes/vscode-colorCustomizations.json.py diff --git a/colorschemes/Makefile b/colorschemes/Makefile index e61e976..d2fa14e 100644 --- a/colorschemes/Makefile +++ b/colorschemes/Makefile @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean OUT_DIR := out -OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css prismjs-theme.css vscode-colorCustomizations.json all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) @@ -20,6 +20,6 @@ out: mkdir -p $@ $(OUT_DIR)/%: %.py _theme.py - ./$< > $@ + python3 ./$< > $@ $(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/colorschemes/out/vscode-colorCustomizations.json b/colorschemes/out/vscode-colorCustomizations.json new file mode 100644 index 0000000..8912830 --- /dev/null +++ b/colorschemes/out/vscode-colorCustomizations.json @@ -0,0 +1,23 @@ +{ + "terminal.background": "#2d2d2d", + "terminal.foreground": "#d3d0c8", + "terminal.selectionBackground": "#515151", + "terminalCursor.background": "#2d2d2d", + "terminalCursor.foreground": "#d3d0c8", + "terminal.ansiBlack": "#2d2d2d", + "terminal.ansiRed": "#f2777a", + "terminal.ansiGreen": "#99cc99", + "terminal.ansiYellow": "#ffcc66", + "terminal.ansiBlue": "#6699cc", + "terminal.ansiMagenta": "#cc99cc", + "terminal.ansiCyan": "#66cccc", + "terminal.ansiWhite": "#d3d0c8", + "terminal.ansiBrightBlack": "#747369", + "terminal.ansiBrightRed": "#f2777a", + "terminal.ansiBrightGreen": "#99cc99", + "terminal.ansiBrightYellow": "#ffcc66", + "terminal.ansiBrightBlue": "#6699cc", + "terminal.ansiBrightMagenta": "#cc99cc", + "terminal.ansiBrightCyan": "#66cccc", + "terminal.ansiBrightWhite": "#f2f0ec" +} diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py new file mode 100755 index 0000000..d139834 --- /dev/null +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import _theme as theme +import json + + +ANSI_COLOR_NAMES = [ + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", +] + +colors = { + "terminal.background": theme.bg, + "terminal.foreground": theme.fg, + "terminal.selectionBackground": theme.selection_bg, + "terminalCursor.background": theme.cursor_fg, + "terminalCursor.foreground": theme.cursor_bg, +} + +for color_brightness in [False, True]: + for color_index, color_name in enumerate(ANSI_COLOR_NAMES): + color = theme.ansi_colors[ + color_index + int(color_brightness) * len(ANSI_COLOR_NAMES) + ] + colors[ + "terminal.ansi" + ("Bright" if color_brightness else "") + color_name + ] = color + +print(json.dumps(colors, ensure_ascii=False, indent=2))