Jak*_*lak 207
"workbench.colorCustomizations": {
"editor.selectionBackground": "#135564",
"editor.selectionHighlightBackground": "#135564"
},
Run Code Online (Sandbox Code Playgroud)
有关更多选项,请参阅主题颜色参考
css*_*hus 15
上面的答案涵盖了Selected text和areas with same content as selection,但是错过了Current Search Match和Other Search Matches- 具有同样的问题。
"workbench.colorCustomizations": {
"editor.findMatchBackground": "#00cc44a8", //Current SEARCH MATCH
"editor.findMatchHighlightBackground": "#ff7b00a1" //Other SEARCH MATCHES
}
Run Code Online (Sandbox Code Playgroud)
请注意,在使用“更改所有出现次数” CtrlF2 (一个超级有用的命令,它会 智能地 选择所有出现的字符串,将光标置于每个位置进行多实例编辑)时,上述设置也会影响颜色。
{
“ git.enableSmartCommit”:是的,
“ git.autofetch”:是的,
“ breadcrumbs.enabled”:是的,
“ git.confirmSync”:否,
“ explorer.confirmDelete”:否,
“ code-runner.saveFileBeforeRun”:是,
“ code-runner.saveAllFilesBeforeRun”:是,
“ workbench.activityBar.visible”:是,
“ files.trimTrailingWhitespace”:是的,
“ telemetry.enableTelemetry”:否,
“ scm.providers.visible”:0,// 0允许手动调整源代码控制面板的大小
“ workbench.colorCustomizations”:{
“ editor.selectionBackground”:“#e788ff7c”,//当前选择的文本
“ editor.selectionHighlightBackground”:“#ff00005b”,//内容与选择相同
“ editor.findMatchBackground”:“#00cc44a8”,//当前的搜索匹配
“ editor.findMatchHighlightBackground”:“#ff7b00a1” //其他搜索匹配
}
}
Depending on your platform, the user settings file is located here:
Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
Run Code Online (Sandbox Code Playgroud)
Ctrl +,(逗号)打开“设置”
工作台
设定编辑器
在顶部的搜索框中,粘贴 workbench.colorCustomizations
在左侧,单击Workbench,然后Appearance
单击右侧的链接: Edit in settings.json
参考文献:
https://code.visualstudio.com/api/references/theme-color#editor-colors
https://code.visualstudio.com/docs/getstarted/themes#_customize-a-color-theme
https://code.visualstudio.com/docs/getstarted/settings
Fuj*_*ale 14
If anyone finds this and, like me, was unable to get the above config working try doing this.
Be sure to replace the #'s with colors you want to see.
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#<color1>",
"editor.selectionBackground": "#<color2>",
"editor.wordHighlightBackground": "#<color3>",
"editorCursor.foreground": "#<color4>"
},
Run Code Online (Sandbox Code Playgroud)
My understanding of the above config.
editor.lineHighlightBackground - when you click on a line this is the color the line background will be.
"editor.selectionBackground" - This is the background of matched selections elsewhere in the buffer. Think of a variable named foo and it's used all over a file. You then highlight that text and all the other foos on the page will be this color.
"editor.wordHighlightBackground" - This is the color of selected text if the default highlight word on click does not take effect. I've only seen this value make a difference if you click on a word that does not auto-select.
editorCursor.foreground - this is the color of your cursor.
Riz*_*izo 12
您可以通过以下方式将其更改为您喜欢的颜色:
脚步
打开设置后,您将更新右侧栏中的设置,将此代码复制并粘贴到主括号内 { ... }
"workbench.colorCustomizations": {
"editor.selectionBackground": "#f00", // red hexadecimal code
"editor.selectionHighlightBackground": "#fff" // white hex code
},
Run Code Online (Sandbox Code Playgroud)
Mat*_*ner 10
更新 请参阅@JakubZawiślak对VScode 1.12+的回答
老答案
Visual Studio Code调用此选项突出显示,不幸的是,我认为当前颜色不可定制.主题可以控制"选择"颜色,但"选择突出显示"颜色是硬编码的.
请参阅此问题,跟踪可能的解决方案:https://github.com/Microsoft/vscode/issues/1636
(作为旁注,您可以使用editor.selectionHighlight设置切换此功能或/关闭.)
正如我测试过的那样,设置边框颜色比设置背景颜色更容易阅读,这是Sublime Text的作用。
例如,将这些行添加到settings.json:
"workbench.colorCustomizations": {
"editor.selectionHighlightBorder": "#FFFA",
},
Run Code Online (Sandbox Code Playgroud)
所选单词将显示为:
This Q&A seems to have evolved into a canonical and the information here is quite scattered and incomplete (there are several different types of highlighting in VS Code!). This is an attempt to defragment/unify/fill.
\nIn general, use subproperties of the workbench.colorCustomizations setting in a settings.json file. You can write colours in the following forms:
"workbench.colorCustomizations": {\n "[Theme Name Goes Here]": { // apply to specific theme. remove this wrapper object to apply to all themes\n // (using the colour red as an example)\n // "selection.background": "#f00", // #RGB (red, green, blue)\n // "selection.background": "#ff0000", // #RRGGBB (red, green, blue)\n // "selection.background": "#f008", // #RGBA (red, green, blue, alpha/opacity)\n // "selection.background": "#ff000080", // #RRGGBBAA (red, green, blue, alpha/opacity)\n },\n},\nRun Code Online (Sandbox Code Playgroud)\nTo make something transparent, set the opacity to zero.
\nI\'ll generally only list the "Background" customization point, but know that for many of these, there is a corresponding "Foreground" customization point to change the colour of the text itself, and sometimes even a customization point for borders. Note that you can find most of these yourself by triggering suggestions after typing "highlight.background" in a settings.json file inside the workbench.colorCustomizations object where a new object key should go.
| Colour Customization Point ID | Description (quoting from tooltip description) | Additional Notes |
|---|---|---|
selection.background | The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor. | |
\xe2\xad\x90 editor.lineHighlightBackground | Background color for the highlight of line at the cursor position. | See also the editor.renderLineHighlight and editor.renderLineHighlightOnlyWhenFocus settings. |
editor.rangeHighlightBackground | Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations. | |
editor.selectionForeground | Color of the selected text for high contrast. | |
\xe2\xad\x90 editor.selectionBackground | Color of the editor selection. | |
\xe2\xad\x90 editor.selectionHighlightBackground | Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations. | See also the editor.selectionHighlight setting |
\xe2\xad\x90 editor.wordHighlightBackground | Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations. | See also the editor.occurrencesHighlight setting |
editor.wordHighlightStrongBackground | Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations. | |
editor.hoverHighlightBackground | Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations. | |
\xe2\xad\x90 editor.findMatchBackground | Color of the current search match. | |
\xe2\xad\x90 editor.findMatchHighlightBackground | Color of the other search matches. The color must not be opaque so as not to hide underlying decorations. | Applies for editor find widget and Search View matches, and also to highlighting list items in the Search View |
editor.findRangeHighlightBackground | 限制搜索范围的颜色。颜色不能是不透明的,以免隐藏下面的装饰。 | |
terminal.findMatchBackground | 终端中当前搜索匹配的颜色。颜色不能是不透明的,以免隐藏底层的终端内容。 | |
terminal.findMatchHighlightBackground | 终端中其他搜索匹配的颜色。颜色不能是不透明的,以免隐藏底层的终端内容。 | |
terminal.hoverHighlightBackground | 终端中其他搜索匹配的边框颜色。 | |
searchEditor.findMatchBackground | 搜索编辑器查询匹配的颜色。 | 什么是搜索编辑器? |
editor.symbolHighlightBackground | 突出显示符号的背景颜色,例如转到定义或转到下一个/上一个符号。颜色不能是不透明的,以免隐藏下面的装饰。 | |
editor.wordHighlightTextBackground | 符号文本出现的背景颜色。颜色不能是不透明的,以免隐藏下面的装饰。 | |
notebook.symbolHighlightBackground | 突出显示单元格的背景颜色 | |
peekViewEditor.matchHighlightBackground | 在预览视图编辑器中匹配突出显示颜色。 | |
peekViewResult.matchHighlightBackground | 匹配速览视图结果列表中的突出显示颜色。 | |
editorBracketMatch.background | 匹配括号后面的背景颜色 | |
editorUnicodeHighlight.background | 用于突出显示 unicode 字符的背景颜色。 |
如果你想复制粘贴骨架:
\n"workbench.colorCustomizations": {\n // "selection.background": "#ff000040",\n "editor.lineHighlightBackground": "#ff000040",\n // "editor.rangeHighlightBackground": "#ff000040",\n // "editor.selectionForeground": "#ff000040",\n "editor.selectionBackground": "#ff000040",\n "editor.selectionHighlightBackground": "#ff000040",\n "editor.wordHighlightBackground": "#ff000040",\n // "editor.wordHighlightStrongBackground": "#ff000040",\n // "editor.hoverHighlightBackground": "#ff000040",\n "editor.findMatchBackground": "#ff000040",\n "editor.findMatchHighlightBackground": "#ff000040",\n // "editor.findRangeHighlightBackground": "#ff000040",\n // "terminal.findMatchBackground": "#ff000040",\n // "terminal.findMatchHighlightBackground": "#ff000040",\n // "terminal.hoverHighlightBackground": "#ff000040",\n // "searchEditor.findMatchBackground": "#ff000040",\n // "editor.symbolHighlightBackground": "#ff000040",\n // "editor.wordHighlightTextBackground": "#ff000040",\n // "notebook.symbolHighlightBackground": "#ff000040",\n // "peekViewEditor.matchHighlightBackground": "#ff000040",\n // "peekViewResult.matchHighlightBackground": "#ff000040",\n // "editorBracketMatch.background": "#ff000040",\n // "editorUnicodeHighlight.background": "#ff000040",\n},\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
42408 次 |
| 最近记录: |