vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Selection and selection matches highlight color

Open klaidliadon opened this issue 10 years ago • 44 comments

image It's really hard to tell which is the selected text and which are the selection matches.

klaidliadon avatar Dec 24 '15 13:12 klaidliadon

@bgashler1 @aeschli

The selection color comes from the monokai theme: rgba(73, 72, 62, 0.5);

The "selection matches" color comes from our css:

.monaco-editor.vs-dark .selectionHighlight {
    background-color: rgba(173,214,255,.15);
}

Should we dynamically compute the .selectionHighlight color starting off the theme selection color?

alexdima avatar Jan 14 '16 11:01 alexdima

@alexandrudima sorry for my delayed response on this one. I think this raises an even more interesting question. Should we allow themes to modify the editor styles beyond what TextMate standards support?

What if when we convert TextMate themes to VS Code, we add a reference to boilerplate of additional customizations in either JSON or CSS (which are commented out by default). These customizations could include "selection matches" and other VS Code specific things. JSON would be the more conservative approach so that only specific values are further customizable and we don't open up the entire stylesheet to extensions.

Your approach above (computing the .selectionHilight) sounds like a good fix as well (and it's certainly easier and more conservative). I just wanted to throw out one more idea. What are your thoughts? Also, @stevencl what do you think?

bgashler1 avatar Feb 03 '16 18:02 bgashler1

The tmTheme editor I've used in the past allows specification of a selection color. Can that value be used?

<dict>
    ...
    <key>settings</key>
    <array>
        <dict>
            <key>settings</key>
            <dict>
                ...
                <key>lineHighlight</key>
                <string>#3E3D32</string>
                <key>selection</key>
                <string>#FFEA00</string>

Tyriar avatar Feb 03 '16 18:02 Tyriar

The lineHighlight from themes is already used, for the line highlight :-)

Adding vscode specific settings is a good option, the tmTheme format allows that. No need to change the theme format. However, as there are already hundreds of themes out there, we could also try to compute the missing color for all themes that don't define the new setting. But how would we compute this? In this case, with the theme's selection color being gray we must know that we must rather something colorful to make a difference. But we must not conflict with any other highlights such as the find match and the work highlight. It's tricky.

aeschli avatar Feb 04 '16 10:02 aeschli

You could take the RGB difference between background and selection, and use a color that is something like:

  • bg + diff/2
  • bg - diff/2

or you could just make the text less lighter/darker of the background, if it's a match and not a selection.

klaidliadon avatar Feb 04 '16 11:02 klaidliadon

@bgashler1 @alexandrudima I'm finding this to be a pretty big annoyance with my theme of choice (One Dark) during what has otherwise my favorite golang code writing experience to date. Is there a workaround/solution for this yet? @bgashler1, your idea of having user defined theme specific settings is pretty much exactly what I would hope for. And you could even make the default the computed value as a guide for the user.

zkilgore avatar Mar 08 '16 20:03 zkilgore

:+1: we should compute all colors from the theme or invent new theme keys and not have any default left overs when switching to a theme.

alexdima avatar Mar 09 '16 17:03 alexdima

:+1: on computing colors as a default, but we should also allow theme creators to specify these values explicitly for the theme if they so desire.

bgashler1 avatar Mar 09 '16 18:03 bgashler1

@alexandrudima @bgashler1 That sounds awesome. Sensible defaults + the ability to customize via config would be sweet!

I'm not exactly sure how this would work as I haven't contributed to open source before, but is there anything with this issue that I could help with? I see that it's in the March milestones now, so does that mean that someone else has taken it on? If there is any way to contribute back to the project please let me know, I'd love to help out anywhere I can.

(Also, this might show my naiveté, but I assume because you guys both have the "Microsoft member" badge and have vscode right at the top of your repos contributed to that you either work there or are core contributors of some sort, which is why I'm asking you for some guidance in how to contribute. And if I am right about that let me also say thank you for this awesome editor!)

zkilgore avatar Mar 09 '16 22:03 zkilgore

Keep in mind when implementing this that we want to support background color in tmThemes https://github.com/Microsoft/vscode/issues/3429

Tyriar avatar Mar 11 '16 05:03 Tyriar

+1

conceptualspace avatar Jun 15 '16 19:06 conceptualspace

I would really love to see that. Miss the green higlight from notepad++. With gray the contrast is too low.

mszczepaniak avatar Jul 22 '16 11:07 mszczepaniak

+1

metabacalhau avatar Jul 27 '16 08:07 metabacalhau

+1

darekzak avatar Jul 27 '16 13:07 darekzak

+1 please address this issue as it's a possible deal breaker for me

dannypule avatar Aug 04 '16 15:08 dannypule

+1 please please fix this.... it's killing me. Tried searching through a minified bootstrap css file and i can't find the matched text. It's horrible

satoru260 avatar Aug 05 '16 09:08 satoru260

The idea of computing colors is related to #9631

bgashler1 avatar Aug 05 '16 20:08 bgashler1

+1

varun-acintyo avatar Aug 09 '16 10:08 varun-acintyo

+1

rivendare avatar Aug 11 '16 05:08 rivendare

+1

ypyf avatar Aug 23 '16 09:08 ypyf