microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.85k stars 8.21k forks source link

Suggestion: Translate vscode color themes to terminal color schemes #4997

Open dperkins3600 opened 4 years ago

dperkins3600 commented 4 years ago

For someone that knew the attributes in both vscode color themes and in terminal color scheme, it seems that it would be easy to write, say, a Python script to do this translation. Because I know neither, I can only describe the need.

zadjii-msft commented 4 years ago

I'm curious how feasible this would actually be. Terminal color schemes are typically described as 16 indexed colors, plus a foreground/background color (and for other terminals, a bold color).

Editor themes usually aren't described like that though, are they? From my experience, they're seemingly more closely related to the token that they're applied to. I'm not sure they are limited to 16 colors, nor do many fill the entire palette. For those that don't use all 16 colors, how do we extrapolate the colors that they do use for a 16 color palette? Someone with more experience authoring VsCode themes would have to chime in on their specifics.

There's also this lovely repo that already contains translated themes for a bunch of different terminals.

dperkins3600 commented 4 years ago

The iTerm2-Color-Schemes repo that you referenced looks very promising. Looking at the schemes for vscode, it looks to be a trivial job to translate vscode, for example: "workbench.colorCustomizations": { "terminal.foreground": "#d0d0d0", "terminal.background": "#212121", "terminal.ansiBlack": "#151515", "terminal.ansiBlue": "#6c99bb", "terminal.ansiCyan": "#7dd6cf", "terminal.ansiGreen": "#7e8e50", "terminal.ansiMagenta": "#9f4e85", "terminal.ansiRed": "#ac4142", "terminal.ansiWhite": "#d0d0d0", "terminal.ansiYellow": "#e5b567", "terminal.ansiBrightBlack": "#505050", "terminal.ansiBrightBlue": "#6c99bb", "terminal.ansiBrightCyan": "#7dd6cf", "terminal.ansiBrightGreen": "#7e8e50", "terminal.ansiBrightMagenta": "#9f4e85", "terminal.ansiBrightRed": "#ac4142", "terminal.ansiBrightWhite": "#f5f5f5", "terminal.ansiBrightYellow": "#e5b567" to terminal: "name": "Campbell", "foreground": "#CCCCCC", "background": "#0C0C0C", "black": "#0C0C0C", "red": "#C50F1F", "green": "#13A10E", "yellow": "#C19C00", "blue": "#0037DA", "purple": "#881798", "cyan": "#3A96DD", "white": "#CCCCCC", "brightBlack": "#767676", "brightRed": "#E74856", "brightGreen": "#16C60C", "brightYellow": "#F9F1A5", "brightBlue": "#3B78FF", "brightPurple": "#B4009E", "brightCyan": "#61D6D6", "brightWhite": "#F2F2F2" Thanks again for pointer to the repo.

PlanMan1717 commented 4 years ago

I can write a python script that can translate for you.

And I'll post it soon on my Github.

The iTerm2-Color-Schemes repo that you referenced looks very promising. Looking at the schemes for vscode, it looks to be a trivial job to translate vscode, for example: "workbench.colorCustomizations": { "terminal.foreground": "#d0d0d0", "terminal.background": "#212121", "terminal.ansiBlack": "#151515", "terminal.ansiBlue": "#6c99bb", ...

DHowett-MSFT commented 4 years ago

If this is possible, it might be a worthwhile feature for colortool. I'm going to recategorize, but feel free to override me.

FredHappyface commented 4 years ago

I've made Base24 (very much based on Base16) that tries to address this problem. Base 24 can be found https://github.com/Base24/base24 and Base16 https://github.com/chriskempson/base16/.

Essentially, it takes a scheme (which is a yaml file of colours) and puts them into template files.

Hope this proves useful

snibo13 commented 4 years ago

I went ahead and wrote a python script that translates a vscode theme to a windows terminal compatible format. The gist is available here: https://gist.github.com/snibo13/7cf5af16ada582c5705c90e3dd7b8ea5 I did notice that the vscode formatting doesn't save the name of the theme so that is a command-line parameter in the code instead.