razor
razor copied to clipboard
Improve contrast for C# content inside attributes.
The difference between a C# value inside an attribute and a string value is minimal. Consider the following example:

The only hint is the "minimal" purple @ in the attribute. Compared to the amount of text, it makes it really hard for the eyesight to differentiate between the two. We should explore using a color with higher contrast to make this difference more obvious.
/cc @danroth27
@danroth27 do you have any input on this?
Razor coloring is tricky because there are so many different token types all mixed together. C# in Razor is colored as C#, which I don't think we want to change. We could try fiddling with how HTML attributes are colored to try to distinguish them more from C# values.
@mikadumont Thoughts?
@danroth27 are you suggesting changing the default HTML coloring? Or only changing that in Razor files?
In general, I like the idea that HTML coloring in Razor is the same as what it is in a normal HTML file. Same idea with C#, CSS, etc. So, if we can find a color for HTML attributes that is visually distinct from C# expressions and still looks in vanilla HTML that seems ideal.
@ToddGrun / @jimmylewis any thoughts?
I'm all for improving the readability here. I'd even say we should look at changing the color for HTML attributes anyway, because it's so close to the color for text

Of course, my default was to consider the color used in VS Code,
but that looks pretty similar to what C# uses for strings, so we end up with something ugly like

That said, I have some concerns about all the cases where this could come up. We can change HTML attributes, but should we also be changing the HTML text color?

That one's a gotcha... it's actually not classified at all! Maybe C# could change its color as well?

Of course, my default was to consider the color used in VS Code,
This was my first thought as well and I think it's a reasonable improvement despite the overlap with C# strings. To distinguish from C# strings, maybe go with something a bit more yellow or red?