Warm tip: This article is reproduced from stackoverflow.com, please click
visual-studio-code vscode-settings

VS Code: How to change text color of selected text?

发布于 2020-05-04 20:35:43

I am trying to change the selected text of highlighted text in VS Code. There are 3 ways I can select text.

My current editor settings are:

    "workbench.colorCustomizations": {
        "editor.selectionHighlightBackground": "#e8fc37",
        "editor.wordHighlightBackground": "#e8fc37",
    },

(1) When I first click or select a string of text,then hiting CMD+d, I can select the next occurrences of a string of text:

enter image description here

(2) But if I try to select the text by first searching for it in the same file(CMD+f), then selecting the next occurrences (pressing CMD+d), the color doesn't highlight. The text does in fact highlight, but it's very difficult to tell. You can only really tell by looking in the gutter where the line numbers are.

enter image description here

(3) When I use the Search command (searching among all files; CMD+Shift+f), and I click on one of the search results, even though it clearly tells me what line the text is one, I can't easily tell where in the line the text is being highlighted. This is tricky when the line is longer or filled special characters.

enter image description here

In all these cases, I would like to have the selected text, whether I'm selecting it by using CMD+d or clicking on a result in a search side bar to have the text be dark gray in the foreground, and yellow in the background. I have been able to achieve the background color change, but don't know the editor key for any of the foreground texts.

How can I get selected text to be yellow in the background (which I have done) with dark gray text?

Questioner
AlanH
Viewed
11
AlanH 2020-02-20 04:17

I finally found a decent solution. Check out 123Dev's response. I just copied the Border key and values and I'm happy enough with it.

"workbench.colorCustomizations": {
    // Totally Transparent
    "editor.selectionHighlightBackground": "#ffffff00",
    "editor.findMatchHighlightBackground": "#ffffff00",
    // Borders
    "editor.findMatchBorder": "#ffff00",
    "editor.findMatchHighlightBorder": "#ff0000",
    "editor.selectionHighlightBorder": "#ffffff",
    "editor.lineHighlightBorder": "#272727",
    // Selection
    "editor.selectionBackground": "#771835",
    "editor.wordHighlightBackground": "#771835",
    // Misc
    "editorCursor.foreground": "#00ff00",
    "editor.lineHighlightBackground": "#181818",
    "editor.findMatchBackground": "#000000",
    // Debugger
    "statusBar.debuggingBackground": "#410d18",
    "statusBar.debuggingForeground": "#dddddd"
}