I want to change / add syntax highlighting for a language in Sublime 2/3.
For example I want the keyword this
colored in JavaScript.
How can I d
Note: This isn't exactly what OP is asking. These instructions will help you change the colors of items (comments, keywords, etc) that are defined syntax matching rules. For example, use these instructions to change so that all code comments are colored blue instead of green.
I believe the OP is asking how to define this
as an item to be colored when found in a JavaScript source file.
Install Package: PackageResourceViewer
Ctrl+Shift+P
> [PackageResourceViewer: Open Resource
] > [Color Scheme - Default
] > [Marina.sublime-color-scheme
] (or whichever color scheme you use)
The above command will open a new tab to the file "Marina.sublime-color-scheme
".
%appdata%
(C:\Users\walter\AppData\Roaming\Sublime Text 3\Packages\Color Scheme - Default\
) . Color Scheme - Default
] is not of a child-dir of [Packages
] dir. I suspect that PackageResourceViewer
is doing some virtualization.optional step: On the new color-scheme tab: Ctrl+Shift+P
> [Set Syntax: JSON
]
Search for the rule you want to change. I wanted to make comments be move visible, so I searched for "Comment
"
"rules"
section "rules":
[
{
"name": "Comment",
"scope": "comment, punctuation.definition.comment",
"foreground": "var(blue6)"
},
Search for the string "blue6":
to find the color variable definitions section. I found it in the "variables"
section.
Pick a new color using a tool like http://hslpicker.com/ .
Either define a new color variable, or overwrite the color setting for blue6
.
blue6
will affect all other text-elements in that color scheme which also use blue6 ("Punctuation" "Accessor").Save your file, the changes will be applied instantly to any open files/tabs.
Sublime will handle any of these color styles. Possibly more.
hsla = hue, saturation, lightness, alpha rgba = red, green, blue, alpha
hsla(151, 100%, 41%, 1) - last param is the alpha level (transparency) 1 = opaque, 0.5 = half-transparent, 0 = full-transparent
hsl(151, 100%, 41%) - no alpha channel
rgba(0, 209, 108, 1) - rgb with an alpha channel
rgb(0, 209, 108) - no alpha channel