-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[themes] Themes don't support background styling #3429
Comments
We had it in, but turned it off as it conflicted badly with the other background decorations we have (selection, word highlighting). |
It's such a handy feature of tmThemes though to draw attention to important things. it's used frequently across themes for invalid and deprecated scopes. |
I strongly disagree with this. Rather than disabling a core component of tmThemes, you would be better off encouraging people to properly port their favorite tmThemes to support VSC's custom background keys when the backgrounds conflict. Consider the difference in message: Current: "if you rely on a theme that uses different background colors for different scopes, you must switch themes completely because we have disabled this functionality." Port on conflict: "if you rely on a theme that uses background colors, you may need to make a minor update to the theme in order for it to look great in VSC (or you could switch to a different theme if that's too much effort)." The first gives the user no options, and does nothing to encourage support for VSC's unique theme settings beyond themes specifically authored for VSC. The second allows the user to make use of whatever theme they like (with caveats), and encourages theme developers to add support for VSC's custom theme keys to existing themes because it broadens the number of editors the theme will support without impacting the theme's display in other editors. It's bizarre to me that you want to take pains to support tmThemes out of the box (to the point of breaking your to-my-mind more sensical scope targeting logic in 1.9), but then silently disable a core colorization component because it sometimes conflicts with your proprietary additions. |
You should add some documentation about which keys you support in a .tmTheme. https://code.visualstudio.com/docs/getstarted/theme-color-reference Would be a good place. |
Does this apply to blocked comments too? I'm having a difficult time trying to figure out how to change the background color of a multi-line comment. Example:
The background color code is not getting applied here. Only the foreground (text) color. |
I'd like to be able to style the background so + 1 from me. |
+1 for me as well. I wanted to port my favorite emacs theme to Code and now I don't see the point. Will this be re-implemented? |
Maybe the conflict can be resolved by adding an alpha value to the color so that the colors can bleed through each other. This is a very desirable and goes a long way to improving readability. One such use case is embedded languages with their own syntax highlighting. Without a background color, it can become difficult quickly distinguish that the embedded language as a different block of logic without making the entire block monochromatic. |
I think this is what I've been searching for since I moved from sublime. On sublime I had a theme that, on the same php file, had different color backgrounds for PHP, HTML and JS code. Is this the situation here? |
The situation here is that it is impossible for themes to have different background colors for different scopes. So you cannot duplicate your Sublime theme in VSCode. |
Sadly this was working a while ago |
@immigrantsheep I don't believe the editor ever had support for background colors. |
My mistake, I was fresh on the team at that point 😄 |
Since it was turned off, is it possible for it to be turned back on by users who need it? |
I see a fully black background in the image above. What's the point? |
If I increase the brightness on my screen I can see that the script scopes are slightly brighter than the others. Not by much though haha. Perhaps would have been been a better illustration of it was a totally different color... Not even sure if that's what it's showcasing either 🤔 |
Like this? |
|
Fenweldryn, babakness, 0xbs0d, nelsonlaquet, NetVicious, Kronuz, zinckiwi, pouyakary, debrouchee, Zireael, saioacoder, chavlji, katerlouis, mika76, sarensw, learn2reid, ryanolsonx, sladec Follow:Step 1: Stop bothering @Tyriar Step 2: Install this: https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-highlight Put this in your settings.json
Step 3: Just remember me in your prayers. |
Hm. Regex parsers usually seek for trouble. They may not find it immediately. |
We do need it. I jst want to make the area of the code block a lighter color, so I can tell the difference between the plain text and the code at a glance. |
I'm having good luck using CSS overrides directly. Just set a unique style for the token in the config, note the CSS class it creates and override it in your CSS. Been working for years flawlessly, and I have full ability to also do some borders, rounding, specific font weights, and other styles that aren't supported in the config. (Just avoid anything that would change the width of a token, such as margins or x-padding.) Frankly at this point I'd rather they just allow us to specify the CSS class (instead of or in addition to the autogenerated class name) than to build new styles into it, since there are way too many awesome things you can do with CSS. |
How to do it? |
Also very curious how exactly you did this? I'm using "Custom CSS and JS Loader" to tweak Material Theme to look more like how my SublimeText Material theme looked. Quite a lot of visual details which made the ST version way more efficient for me. But this extension isn't the most solid and often requires me to execute the command "Reload Custom CSS and JS", after which VSC cries that the installation is now corrupt :D – Which way are u using to add the backgrounds? Maybe you could post the exact classes you have to alter to simply add a slightly different background to |
There's no script involved here, y'all.
I assume you've gotten that far if you're asking about background colors being unsupported. Now, right-click on some highlighted word in your editor and inspect the DOM to see what class name Monaco auto-generated for that theme rule. Then, use plain old CSS somewhere on your page to override that class with whatever styling is more to your liking, including backgrounds. You cannot predict the specific class name that Monaco will assign fully, but as long as you don't change the tokenizer or theme rules, the class names will be the same for all users. You'll just need to shift some CSS around when you have to make updates to your custom language. I've been doing it this way for years, works fine. |
Bikeshedding?: Yes |
+1 for the ability to set background color. Re: the custom CSS method. Let's say you want to make type annotations have a grayish background, like so: Here's one way to do this.
This method doesn't really scale for obvious reasons (you quickly run out of the permutations), but it's okay if you only have a small number of things you want to set a custom background color for. |
Does anyone know the exact commit that removed this? |
|
Still relevant |
I'm not familiar with how text / canvas layering in the editor component works, so excuse my ignorance, but I wonder if the Related on Stack Overflow: |
#580 would presumably resolve this; if extensions could access the textmate scopes, then they could use this to apply custom highlights instead of using regexes. |
I was so surprised when didn't find "background" hinted by autocomplete. But I was even more surprised when I saw this thread. I was literally astounded when I read that 8 years ago the team stated "I'd say we accept this as limitation and tell to better use themes that don't rely on background colors." and still there we are. We are talking about a very basic and very expected feature here. Everyone using a customizable coding IDE expects a background to be changeable along with the foreground. I understand might be a difficult issue to tackle, but nothing that your very competent team couldn't handle I guess. Probably not tomorrow, but please ping us back on this and give us hope claiming that someone is working on this and that there is a deadline, even far, in sight. |
Looks like it was removed at or before 122a07b in December 2016. See how the color service only puts foreground color for the token, at standaloneColorServiceImpl.ts:31.
I think it's way too far back for that. See /pull/212294 for a simple alternative. |
### wow. |
Zed already has this feature, just sayin. |
All the weekend I've been setting up bits and pieces to make VSCode my primary IDE for coding. Dopamine went ever higher when I discovered TextMate rules and the option to style font/color/?background? for specific scopes - even to a greater detail than I had in PhpStorm. Wait, no background? What? Bang! The thread I'm reading and response from the VSCode team has knocked me out.... The insane level of customizability which is the primary strength of VSC has been crippled in one of the most primary features. If as @aeschli says it messed up with other background styles it should be left as an option for the user to decide if they want to use it or not. Disabling it altogether is a shot in the foot and defeats the spirit of VSC. |
I agree.Still. After all this time. On Dec 16, 2024, at 20:27, Konrad Tomaszewski ***@***.***> wrote:
All the weekend I've been setting up bits and pieces to make VSCode my primary IDE for coding. Dopamine went ever higher when I discovered TextMate rules and the option to style font/color/?background? for specific scopes - even to a greater detail than I had in PhpStorm. Wait, no background? What? Bang! The thread I'm reading and response from the VSCode team has knocked me out....
All the scopes in my files MUST look the same. Period.
The insane level of customizability which is the primary strength of VSC has been crippled in one of the most primary features. If as @aeschli says it messed up with other background styles it should be left as an option for the user to decide if they want to use it or not. Disabling it altogether is a shot in the foot and defeats the spirit of VSC.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
.tmTheme files allow specification of background colors which don't seem to be supported, for example:
This is especially problematic for themes that attempt to invert background and use a similar foreground to the text view's background color (#2158)
The text was updated successfully, but these errors were encountered: