简体   繁体   English

如何为VSCode的输出面板添加自定义颜色

[英]How do I add a custom colorization for VSCode's Output Panel

I have installed the Output Colorizer extension for VSCode. 我已经为VSCode安装了Output Colorizer扩展。 However, there aren't any instructions for it that I could find. 但是,我找不到任何说明。 All I know is the extension creates "text/log", "text/x-log", "text/x-code-output", "x-code-output" mime-types.. which would allow me to specify custom colors for specific scopes that affect the Output Panel. 我所知道的是该扩展创建了“ text / log”,“ text / x-log”,“ text / x-code-output”,“ x-code-output” mime-types ..这将允许我指定自定义影响“输出面板”的特定范围的颜色。 All I've done is install the Output Colorizer extension. 我要做的就是安装Output Colorizer扩展程序。

What can I put in my settings.json file in order to override the text colors for the VSCode's Output Panel (in the screenshot below)? 为了覆盖VSCode的“输出面板”的文本颜色(在下面的屏幕截图中),我可以在settings.json文件中放什么? I do not want to change my current "black" Panel background color, only the text color in this panel without affecting the text in the Editor pane . 我不想更改当前的“黑色”面板背景颜色,仅更改此面板中的文本颜色而不影响“编辑器”面板中的文本 I can change the dark red color below, but not without changing the color for the strings scope for all languages. 我可以在下面更改深红色,但是不能不更改所有语言的字符串范围的颜色。

在此处输入图片说明

The colorizer extension just uses regular expressions to parse strings/numbers/quotes/dates/etc... and uses the default styles from your selected VS Code theme and applies them. colorizer扩展仅使用正则表达式来解析字符串/数字/引号/日期/等...,并使用所选VS Code主题中的默认样式并应用它们。

You can see the mapping of regex to the theme's css styles here: https://github.com/IBM-Cloud/vscode-log-output-colorizer/blob/master/src/syntaxes/log.tmLanguage#L14 您可以在此处查看正则表达式到主题的CSS样式的映射: https : //github.com/IBM-Cloud/vscode-log-output-colorizer/blob/master/src/syntaxes/log.tmLanguage#L14

For example, dates will be given the constant.numeric style: 例如,日期将被赋予constant.numeric样式:

<dict>
    <!-- Date MM/DD/(YY)YY -->
    <key>match</key>
    <string>\b(((0|1)?[0-9][1-2]?)|(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sept(ember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?))[/|\-|\.| ]([0-2]?[0-9]|[3][0-1])[/|\-|\.| ]((19|20)?[0-9]{2})\b</string>
    <key>name</key>
    <string>constant.numeric</string>
</dict>

Unfortunately, this extension does not allow you to specify your own styles or rules, but I'll keep that in mind as a new feature request. 不幸的是,此扩展不允许您指定自己的样式或规则,但是作为新功能请求,我会牢记这一点。

(I am the extension author). (我是扩展作者)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM