You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[themes] make color themes user configurable #11556
I really liked the last updates the team has made in order to improve Code even further, but one thing I do miss from Atom (since I switched to Code) is the ability to change the syntax highlighter colors on the fly, we could just open the debug tools, look into the classes, then just finding them inside the less file and boom! We could change the way languages were colored inside the editor.
This is something that really annoys me because some languages simply do not have color support...
Reacted by Joël R. Langlois, Victor Mejia, František Svoboda, Dakara, Jens Hausdorf, Benjamin Lupton, Cody Hoover, Carter Li, ugurozturk, Peter Timoshevsky and 11 more
You can switch color themes, and also create your own themes. To change the colors on the fly, you could open the dev tools and modify the underlying colors in the css.
Not sure how that helps you with languages that don't have color support. That has to do with the installed grammar. Can you tell me more how you modify these?
I don't think color themes has much to do with it... The problem I'm raising is about syntax coloring, for instance, on PHP language I have a #FA45AB color for variables, but I don't want that color, I want to change it so I can have a better experience and a better view of my code.
In Atom (as an example), we could open the base CSS file used by the editor to colorize the whole syntax (regardless of the color theme), and edit it.
What I'm proposing is: Editable syntax colorizers. Or something that is not bound to the color theme so the user can edit the colorizer the way it fits best to him.
But I understand you want to change these colors without having to create your own theme, e.g. in the user settings. I updated the issue description, let me know if I misunderstood.
Even further, I think it would be nice to "detach" the colors from the themes. In other words, make possible to have a "global" style config which applies to all editor and overwrites theme-specific colorization.
To get around this for now I have been just adding a custom style sheet. Borrowing the loadjscssfile function from here I just load a css file that I add custom css classes to. I run the function from the console. Very clunky but I think it demonstrates that this kind of feature should not be that difficult to implement.
Again, you should really look into creating your own theme. Take a theme you like, copy it, change the name, link it to your extensions folder. Start VSCode, pick the new theme. Change some colors in the theme file, 'Reload window' and you see the new colors. And if you got the perfect colors you can even publish it and share it with the community. I'm 100% sure that's easier than hacking scripts, and also what you would do in the user configurations if we added that support there.
Yeah, it's cool but I think to create a theme just to change some colors is a bit too much... Maybe if we could just create colorizers and share them with the community... It'd be nice too 😃
You know rolling your own Theme is not exactly easy. There is a good deal of trial and error - then once you get it working in debug you have to then deploy it. Then 10mins later you open some file type you thought would be covered and find yourself back again.
A Theme that works for one language generally does not in another. For example, most of the themes are pretty bad at XML and property files. So if you really want to get VSCode usable across many languages (that is the whole reason I am interested in it) you have to actually create language specific themes and merge them all into one big mega-theme. This is quite time-consuming. My little hack takes moments -- however, I don't see why it can't be an extension.
Martin Aeschlimann (@aeschli) I am in the process of porting a theme I wrote for sublime to vscode. There are many missing scope selectors in vscode that are present in sublime. Can I setup my setup my vscode extension with extra .tmLanguage files that augment the existing vscode language definitions?
I read through the vscode documentation, but it's still pretty unclear to me how I go about augmenting the scope selectors for existing languages. Perhaps you could explain (or point me in the right direction) how I could augment the existing JavaScript scopes with Babel's definitions, and roll that up in my theme extension.
Breaking the source code up into scopes is the responsibility of what we call the grammar, specified by tmLanguage files. You can't augment the built-in grammars, but replace them, by contributing a grammar for the same language id. See here for the grammar contribution point.
Your package json would look like that, assuming you want to replace the javascipt grammar:
Additionally to that you could add your color theme, but you'd rather keep them in separate extensions.
Having said that, color themes should work equally well will all grammars ant not rely on specific scopes.
For what it's worth, I've been able to automate the customisation of a theme to a certain extent by creating a bash script that does a replacement of the theme file of the specified theme. It works well.
I can see that this issue has more recent activity than #459 which seems to cover the same topic. I suggest closing the other issue as this issue has more substantial conversation on it.
I would also like to elaborate on a use case that I would like for this:
For my personal development environment I would like to override the font that I use to be the Operator Mono font and I want certain tokens to be italicized (attribute names in html, literal values in javascript, etc.).
I would like these settings to be able to exist apart from the theme I am using which I primarily use to get the colors that I want.
My ideal scenario is that I set the fonts how I want them and then I go to the extension gallery, download a bunch of themes, and switch through them all until I find the color set that I want that looks good with my font choice.
I can, of course, pick one theme, fork it, and manually apply my settings, but I might switch between white and dark themes for presenting and coding, so I have to manually apply two sets of changes. Then if a new color theme comes out (somebody makes a beautiful Material inspired theme, for example). Now I have to do it again.
I hope that this request gains traction, or if the team is open to PR's they provide guidance on how we can help.
Cody Hoover (@hoovercj) This is exactly the same use case I had when I created this issue. I think this kind of customization is what most attracts a dev to a familiar workspace, so you can identify parts of your code more easily, it is more productive.
František Svoboda (@PunchyRascal) Thanks for the dev tools tip. I just wanted readable punctuation in a theme I otherwise loved! It really shouldn't be so hard to target a simple customization...
What about a tool that displays all font colors used in a theme with user setting targetable key names? (I apologize if it's already suggested!)
Martin Aeschlimann (@aeschli) we discussed this ability in #21981 but the PR was closed until you could complete the work that you completed with workbench.colorCustomizations but I don't believe that workbench.colorCustomizations addresses this issue. This issue relates to general theme customizations, not only workbench customizations and not only color customizations (I really want to modify the fontStyle to get italics into my themes).
Can we re-open this issue? I'd really like to look at the changes you made and revisit caigo@ (@21981) to see how we can more fully address this.
Cody Hoover (@hoovercj)
If you want to want to work on a PR that adds the possibility to add token color rules in the settings, that would be great. But let's create a new issue so we can discuss the design there. I created #27894 with some ideas.
Activity
aeschli commentedon Sep 6, 2016
You can switch color themes, and also create your own themes. To change the colors on the fly, you could open the dev tools and modify the underlying colors in the css.
Not sure how that helps you with languages that don't have color support. That has to do with the installed grammar. Can you tell me more how you modify these?
khaosdoctor commentedon Sep 6, 2016
I don't think color themes has much to do with it... The problem I'm raising is about syntax coloring, for instance, on PHP language I have a
#FA45ABcolor for variables, but I don't want that color, I want to change it so I can have a better experience and a better view of my code.In Atom (as an example), we could open the base CSS file used by the editor to colorize the whole syntax (regardless of the color theme), and edit it.
What I'm proposing is: Editable syntax colorizers. Or something that is not bound to the color theme so the user can edit the colorizer the way it fits best to him.
Thanks! 😄
[-][Feature] "Hackable" CSS colorizers[/-][+][themes] make color themes user configurable[/+]aeschli commentedon Sep 6, 2016
The color of the variable scope is defined by the color theme. E.g. for the Dark default color theme the variable color is defined here: https://github.com/Microsoft/vscode/blob/master/extensions/theme-defaults/themes/dark_plus.json#L49. Theme allow you to even define php specific colors.
But I understand you want to change these colors without having to create your own theme, e.g. in the user settings. I updated the issue description, let me know if I misunderstood.
khaosdoctor commentedon Sep 6, 2016
Yes! This is it.
Even further, I think it would be nice to "detach" the colors from the themes. In other words, make possible to have a "global" style config which applies to all editor and overwrites theme-specific colorization.
NickDMax commentedon Sep 7, 2016
To get around this for now I have been just adding a custom style sheet. Borrowing the loadjscssfile function from here I just load a css file that I add custom css classes to. I run the function from the console. Very clunky but I think it demonstrates that this kind of feature should not be that difficult to implement.
aeschli commentedon Sep 7, 2016
Again, you should really look into creating your own theme. Take a theme you like, copy it, change the name, link it to your extensions folder. Start VSCode, pick the new theme. Change some colors in the theme file, 'Reload window' and you see the new colors. And if you got the perfect colors you can even publish it and share it with the community. I'm 100% sure that's easier than hacking scripts, and also what you would do in the user configurations if we added that support there.
khaosdoctor commentedon Sep 7, 2016
Yeah, it's cool but I think to create a theme just to change some colors is a bit too much... Maybe if we could just create colorizers and share them with the community... It'd be nice too 😃
NickDMax commentedon Sep 8, 2016
You know rolling your own Theme is not exactly easy. There is a good deal of trial and error - then once you get it working in debug you have to then deploy it. Then 10mins later you open some file type you thought would be covered and find yourself back again.
A Theme that works for one language generally does not in another. For example, most of the themes are pretty bad at XML and property files. So if you really want to get VSCode usable across many languages (that is the whole reason I am interested in it) you have to actually create language specific themes and merge them all into one big mega-theme. This is quite time-consuming. My little hack takes moments -- however, I don't see why it can't be an extension.
johndugan commentedon Sep 8, 2016
Martin Aeschlimann (@aeschli) I am in the process of porting a theme I wrote for sublime to vscode. There are many missing scope selectors in vscode that are present in sublime. Can I setup my setup my vscode extension with extra .tmLanguage files that augment the existing vscode language definitions?
I read through the vscode documentation, but it's still pretty unclear to me how I go about augmenting the scope selectors for existing languages. Perhaps you could explain (or point me in the right direction) how I could augment the existing JavaScript scopes with Babel's definitions, and roll that up in my theme extension.
aeschli commentedon Sep 8, 2016
Breaking the source code up into scopes is the responsibility of what we call the grammar, specified by tmLanguage files. You can't augment the built-in grammars, but replace them, by contributing a grammar for the same language id. See here for the grammar contribution point.
Your package json would look like that, assuming you want to replace the javascipt grammar:
Additionally to that you could add your color theme, but you'd rather keep them in separate extensions.
Having said that, color themes should work equally well will all grammars ant not rely on specific scopes.
8 remaining items
balupton commentedon Mar 3, 2017
For what it's worth, I've been able to automate the customisation of a theme to a certain extent by creating a bash script that does a replacement of the theme file of the specified theme. It works well.
https://github.com/balupton/dotfiles/blob/64a4ca5700f43a4f4ad50878d7e90a3627b84382/.user.sh#L459-L468
hoovercj commentedon Mar 3, 2017
I can see that this issue has more recent activity than #459 which seems to cover the same topic. I suggest closing the other issue as this issue has more substantial conversation on it.
I would also like to elaborate on a use case that I would like for this:
For my personal development environment I would like to override the font that I use to be the Operator Mono font and I want certain tokens to be italicized (attribute names in html, literal values in javascript, etc.).
I would like these settings to be able to exist apart from the theme I am using which I primarily use to get the colors that I want.
My ideal scenario is that I set the fonts how I want them and then I go to the extension gallery, download a bunch of themes, and switch through them all until I find the color set that I want that looks good with my font choice.
I can, of course, pick one theme, fork it, and manually apply my settings, but I might switch between white and dark themes for presenting and coding, so I have to manually apply two sets of changes. Then if a new color theme comes out (somebody makes a beautiful Material inspired theme, for example). Now I have to do it again.
I hope that this request gains traction, or if the team is open to PR's they provide guidance on how we can help.
khaosdoctor commentedon Mar 4, 2017
Cody Hoover (@hoovercj) This is exactly the same use case I had when I created this issue. I think this kind of customization is what most attracts a dev to a familiar workspace, so you can identify parts of your code more easily, it is more productive.
beansprout commentedon May 12, 2017
František Svoboda (@PunchyRascal) Thanks for the dev tools tip. I just wanted readable punctuation in a theme I otherwise loved! It really shouldn't be so hard to target a simple customization...
What about a tool that displays all font colors used in a theme with user setting targetable key names? (I apologize if it's already suggested!)
aeschli commentedon May 15, 2017
Customizing of theme colors has been added to the April release.
Check our the
workbench.colorCustomizationssetting.Rhywun commentedon Jun 1, 2017
Should note that this still doesn't allow changing syntax token colors like I was hoping.
hoovercj commentedon Jun 1, 2017
Martin Aeschlimann (@aeschli) we discussed this ability in #21981 but the PR was closed until you could complete the work that you completed with
workbench.colorCustomizationsbut I don't believe thatworkbench.colorCustomizationsaddresses this issue. This issue relates to general theme customizations, not only workbench customizations and not only color customizations (I really want to modify the fontStyle to get italics into my themes).Can we re-open this issue? I'd really like to look at the changes you made and revisit caigo@ (@21981) to see how we can more fully address this.
khaosdoctor commentedon Jun 2, 2017
Rhywun Yep, the update does not allow us to change the syntax color only...
aeschli commentedon Jun 2, 2017
Cody Hoover (@hoovercj)
If you want to want to work on a PR that adds the possibility to add token color rules in the settings, that would be great. But let's create a new issue so we can discuss the design there. I created #27894 with some ideas.