Plugins HighlightWords in Sublime Text 3 How to configure? - plugins

Hello I have downloaded the Plugins HighlightWords to use it with Sublime Text 3 that promises to highlight words using some of the colors. Download it from here:
https://github.com/seanliang/HighlightWords
Could someone help me to change the color of highlighted by default. What I have tried I have not been able to do. This is the file to modify:
{
// The colors to highlight texts are specified by a list of theme scope names,
// and HighlightWords uses this list in circular order.
"colors_by_scope":
[
//"keyword",
//"number",
"string",
"entity.name.class",
"variable.parameter",
"invalid.deprecated",
"invalid",
"support.function"
],
"whole_word": false,
"use_regex": false,
"ignore_case": false,
// Keywords to be always highlighted, clear the list to disable it.
// "keyword" are literally matched, and "color" refers to theme scope names.
// Note that json has some special characters like '\' should be escaped.
"permanent_highlight_keyword_color_mappings":
[
//{"keyword": "TODO", "color": "support.function"},
//{"keyword": "FIXIT", "color": "support.function"},
]
}

You can override default plugin settings in plugin user settings. Goto menu Preferences > PackageSettings > HighlightWords > Settings-User , then add the words and colors you want overriding permanent_highlight_keyword_color_mappings property. Example content:
{
"permanent_highlight_keyword_color_mappings":
[
{"keyword": "stackoverflow", "color": "variable.parameter"},
{"keyword": "sublime", "color": "string"},
{"keyword": "plugin", "color": "invalid.deprecated"},
]
}
Save the file and maybe you need to restart sublime. Result:

Related

VSCode settings : colorize custom tags that start with the "x-" prefix

I want to write a vscode setting in which tags ( inside .vue file ) that start with the prefix x- will be colored green.
tags like <x-component></x-component> and <x-lorem></x-lorem>
is it possible? and how
i tried this
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "entity.name.tag.x-*",
"settings": {
"foreground": "#00ff00"
}
}
]
},
and it not works
Unfortunately, it seems that this is not possible without installing the plugin
I used the Highlight plugin mentioned by #rioV8
it works
this is my config :
"highlight.regexes": {
"(<[^>]*x-[^>]*>)": { // A regex will be created from this string, don't forget to double escape it
"decorations": [ // Decoration options to apply to the capturing groups
{ "color": "#7ac379" }, // Decoration options to apply to the first capturing group, in this case "//<-x:"
]
}
}

How to change the color of "comment definition characters" in VSCode [duplicate]

This question already has answers here:
Change color of characters surrounding comments in VS Code
(2 answers)
Closed 3 years ago.
I'm using Windows 10 64-bit.
I currently am overriding some settings for a theme I like, but noticed that the comma color I chose does not change the # from the theme as well:
{
"workbench.colorTheme": "Material Theme Darker High Contrast",
"editor.tokenColorCustomizations": {
"[Material Theme Darker High Contrast]": {
"comments": "#229977"
"types": "#f64343"
}
},
}
How could I change the # to be the same color as I set the comments itself?
If I understand your question the "comment definition" characters is in the theme "grey" and with your settings the comment text is now green.
To also color the "comment definition" characters add these to your settings
"workbench.colorTheme": "Material Theme Darker High Contrast",
"editor.tokenColorCustomizations": {
"[Material Theme Darker High Contrast]": {
"comments": "#229977",
"textMateRules": [
{ "scope":"punctuation.definition.comment",
"settings": {"foreground": "#229977"}
}
]
}
},
This is valid for JSON files and Python.
For which file type do you need the customisation? The rule names vary.

VSCode - Change color of typescript function decorator

Is there a way to change the syntax highlight color of decorators in VSCode? Given the small example :
#HostListener('mouseenter')
onMouseEnter() {}
Both #HostListener and onMouseEnter are highlighted in the same color. I want to change that.
So far I tried messing with "editor.tokenColorCustomizations": { "functions" : "SomeColorHere"}}, but this changes both the decorator and the function declaration.
Here is my config to use TODO highlight as Mark advised, i excluded require and import to avoid interfering with js and stylus
quick note on the screenshot: the default italic style is from here, and the inline property is from here
"todohighlight.isEnable": true,
"todohighlight.isCaseSensitive": true,
"todohighlight.keywordsPattern": "#(?!require|import)[\\w-_.]*",
"todohighlight.defaultStyle": {
"color": "#1E88E5",
"backgroundColor": "0",
"fontWeight": "bold"
},
"todohighlight.include": [
"**/*.js",
"**/*.ts",
"**/*.vue",
],
"todohighlight.exclude": [
"**/node_modules/**",
"**/bower_components/**",
"**/dist/**",
"**/build/**",
"**/.vscode/**",
"**/.github/**",
"**/_output/**",
"**/*.min.*",
"**/*.map",
"**/.next/**"
],
"todohighlight.maxFilesForSearch": 5120,
See inspecting textmate scopes and similar for how to see the scope of your syntax. So something like this will change the color of the decorator symbol # :
{
"scope": [
"punctuation.decorator.js",
// "meta.decorator.js",
],
"settings": {
"foreground": "#e100ff",
"fontStyle": "bold"
}
}
This only affects the # symbol, I couldn't find a way to color the # symbol and its associated function name and no other function names.
There is a workaround that could do that if you really want it. And that is to use a word highlighter like TODO highlight and make a regex that does what you want. Like:
"todohighlight.keywordsPattern": "#[\\w-_]*",
"todohighlight.defaultStyle": {
"color": "red",
// "letterSpacing": "1px",
// "backgroundColor": "rgba(170,102,0,1)",
"backgroundColor": "transparent",
// "borderRadius": "4px",
"isWholeLine": false
}

How do I change color of comments in visual studio code?

I went through https://code.visualstudio.com/docs/getstarted/theme-color-reference but can't seem to find the setting for changing the comment color.
I am currently using Atom One Dark Theme and just like to lighten the color a little bit so I can read it better.
From 1.15 (July 2017) you can change it from settings.json Ctrl+,
"editor.tokenColorCustomizations": {
"comments": "#d4922f"
},
From 1.20 (January 2018) you can also do it for each theme separately:
"editor.tokenColorCustomizations": {
"[Atom One Dark]": {
"comments": "#d4922f"
}
},
Or now you can specify settings for multiple themes at once as "[Atom One Dark][Tomorrow Night Blue]": {...}
Finding the right scope:
Developer: Inspect TM Scopes editor.action.inspectTMScopes
Selector priority:
https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_textmate-themes
Ok, more examples (for js):
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "INSERT_SCOPE_HERE",
"settings": {
"foreground": "#ff0000"
}
}]
}
comment
punctuation.definition.comment
comment.block.documentation
storage.type.class.jsdoc
entity.name.type.instance.jsdoc
variable.other.jsdoc
1.Go to your settings.
2.Type “editor.tokenColorCustomizations” into the search bar then click on “Edit in settings.json”:
3.By default, “editor.tokenColorCustomizations” is set to “null”. To customize the comment color, you can add:
{ "comments": "[color code]" }
You can type something like this:
> "editor.tokenColorCustomizations": {
> "comments": "#e45e91" },
4.Change the color of comments,based on your liking by hovering over the color and choosing your desired color.
5.Then save the changes.(Ctrl+S)
6.Exit the program. open it again, you will see the changes.
To expand on the answer and #Johnny Derp's comment. You can change the font color and style using:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "comment",
"settings": {
"fontStyle": "italic",
"foreground": "#C69650",
}
}
]
},
background cannot be changed in this way, only the color and style. As of June, 2018.
Also in answer to a couple of comments about changing comments puntuation (like the //) colors - which now have to be separately colored with their own textmate rule, a change may be coming to fix that in the October 2019 release - at this point it is an unresolved issue but added to the October 2019 milestone. See https://github.com/microsoft/vscode/milestone/102
In VS Code: 1.56.2
Add to settings.json:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"comment.block.documentation",
"comment.block.documentation.js",
"comment.line.double-slash.js",
"storage.type.class.jsdoc",
"entity.name.type.instance.jsdoc",
"variable.other.jsdoc",
"punctuation.definition.comment",
"punctuation.definition.comment.begin.documentation",
"punctuation.definition.comment.end.documentation"
],
"settings": {
"fontStyle": "italic",
"foreground": "#287a1d"
}
}
]
}
If there is still stoff missing: CTRL+SHIFT+P => Developer: Inspect Editor Tokens and Scopes hover over the parts that are not colored correctly and add them to "scope".
There you are. :)
Looks like the token colors cannot be customized within the settings at the moment:
The most prominent editor colors are the token colors that are based
on the language grammar installed. These colors are defined by the
Color Theme and can (currently) not be customized in the settings.
Source: https://code.visualstudio.com/docs/getstarted/theme-color-reference
I did notice that if you go into the theme folders, for example:
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\theme-monokai
and edit the monokai-color-theme.json file, look for the line with "name": "Comment" and change the "foreground" color it will work. Just make sure to restart the program.
Like Mark said, but add in the "scope": after "comment"
"punctuation.definition.comment"
to color also the punctuation,
e.g. (// in javescript | /* */ in css | <!-- --> in html).
"scope": ["comment", "punctuation.definition.comment"]
While commenting on comment subject, I found "Better Comments" extension of VS Code very useful. You can give various colors ‎to your comments and hence categorize your comments based on importance etc. ‎
Default comments color can also be changed.‎
https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
Example:‎
This extension can be configured in User Settings or Workspace settings.‎
Doc, Block, and Line settings
To have differnet colors for Doc, Block, and Line comments:
I.e. for the Cobalt2 theme:
"editor.tokenColorCustomizations": {
"[Cobalt2]": {
"textMateRules": [
{
"scope": [
"comment.block",
"punctuation.definition.comment.end",
"punctuation.definition.comment.begin"
],
"settings": {
"foreground": "#85b3f8",
"fontStyle": "bold"
}
},
{
"scope": [
"comment.block.documentation",
"punctuation.definition.comment.begin.documentation",
"punctuation.definition.comment.end.documentation"
],
"settings": {
"foreground": "#6bddb7",
"fontStyle": "bold"
}
},{
"scope":["comment.line", "punctuation.definition.comment"],
"settings": {
"foreground": "#FF0000",
"fontStyle": "bold"
}
}
]
}
}
Tested with C++.
You can modify your VS code by simply edit your setting file in VS code and follow these 3 steps.
step1:
step2:
Step3:
To change VS Code comment color
File --> Preferences --> Settings
Choose the "Workspace Settings" tab to only change it for this project
Choose the "User Settings" tab to change it for all projects
Do a search for "settings.json" and look for an option to "Edit in settings.json"
Insert this color setting for the comments somewhere inside the curly brackets:
"editor.tokenColorCustomizations": {
"comments": "#ff4"
}
It might complain that you are overriding your current color theme, just ignore that.
If there is already a section for "editor.tokenColorCustomizations" then just add the line to specify the comment color.

How change the color of rulers in Visual Studio Code

Not sure if this feature is included in the VSCode settings yet, but I'd love to change the ruler color from it's default grey.
Tried:
"editor.rulers.color": "color"
But got an "unknown configuration setting error.
From the February 2020 v1.43 release, you can set per-ruler colors. Use like this:
"editor.rulers": [
{
"column": 80,
"color": "#ff00ff"
},
100, // a ruler with the default or editorRuler.foreground color at column 100
{
"column": 120,
"color": "#ff0000"
},
],
See the release notes here: https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_43.md#multiple-rulers-with-different-colors
In settings.json:
"workbench.colorCustomizations": {
"editorRuler.foreground": "#ff333388"
}
File -> Preferences -> Settings Or cntrl+,
type "rulers" and click Edit Setings.json
3. Add the size value by ',' As you wish
"workbench.colorCustomizations": {
"editorRuler.foreground": "#0ddf73"
},
Like this(Gif)