Colorcoder
Semantic highlight for Sublime Text
Details
Installs
- Total 8K
- Win 4K
- OS X 3K
- Linux 1K
| Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 19 | 12 | 7 | 27 | 20 | 34 | 39 | 35 | 20 | 18 | 10 | 23 | 14 | 22 | 15 | 13 | 18 | 31 | 39 | 33 | 25 | 27 | 12 | 21 | 22 | 26 | 27 | 20 | 19 | 8 | 15 | 27 | 29 | 26 | 24 | 27 | 14 | 16 | 29 | 34 | 27 | 30 | 22 | 14 | 14 | 18 |
| OS X | 11 | 8 | 9 | 19 | 10 | 17 | 15 | 24 | 6 | 1 | 17 | 6 | 17 | 10 | 20 | 10 | 16 | 18 | 17 | 16 | 16 | 26 | 20 | 11 | 6 | 13 | 7 | 11 | 12 | 5 | 10 | 8 | 18 | 10 | 13 | 9 | 7 | 3 | 12 | 7 | 11 | 12 | 16 | 14 | 4 | 6 |
| Linux | 4 | 3 | 4 | 4 | 10 | 2 | 12 | 9 | 10 | 8 | 5 | 8 | 11 | 1 | 11 | 3 | 4 | 20 | 7 | 11 | 12 | 9 | 3 | 6 | 13 | 6 | 4 | 1 | 10 | 3 | 3 | 2 | 2 | 5 | 8 | 10 | 1 | 6 | 3 | 8 | 3 | 3 | 6 | 1 | 6 | 5 |
Readme
- Source
- raw.githubusercontent.com
Colorcoder
This plugin for Sublime Text will highlight every variable in its own, consistent color — feature known as semantic highlighting, variable-name highlighting, contextual highlighting — you name it.
Notice how all instances of m_nValue share the same color
Motivation
- “Coding in color” by Evan Brooks
- actually thought about something to improve the current highlighting system and accent the data flow
- help dysgraphic/dyslexic coder
it is important to note i use a crc8 hash of the variable name to give similar named variables distinct colors to improve typo recognition
Installation
Download the zip-ball and unpack to sublime\data\packages or via packageControl. Please make sure to name the resulting folder Colorcoder not .Sublime-Colorcoder
To properly work Colorcoder need an appropriately modified color scheme. On the first run plugin will try its best to automatically modify your current scheme. :grey_exclamation: the plugin will not actually modify the scheme but create a modified copy in its own directory and apply it.
You can use Tools▶Packages▶Colorcoder▶Tweak Colorcode on current color scheme (or CTRLSHIFTP it) to modify the colors a bit (you can change the lightness and saturation).
Supported Languages
As few language definitions provided by Sublime are insufficient for optimal Colorcoder results i bundle tailored definitions. So far its
for JavaScript please use the JavaScript Next package.
You can set them up as default via language menu▶Open all with current extension as▶Colorcoder▶… (Colorcoded) or copy them to appropriate folder (erg. Packages/Colorcoder/Python (Colorcoded).tmLanguage to Packages/Python/Python.tmLanguage.
You can also add more scopes for the plugin to colorize via the scopes setting. Colorcoder comes with a handy command colorcoder_inspect_scope which will print the scope of the token under text cursor to the console. You can bind it to a key (e.g. CTRLF12) by adding following to Preferences▶Key Bindings – User
{ "keys": ["ctrl+f12"], "command": "colorcoder_inspect_scope"},
Sometimes things we are interested in don't have distinct scope e.g. the variables in Javascript are only source.js. You would need to modify the .tmLanguage.
- First you need to obtain it - it is inside the same names
.sublime-packagefile, which is a zip-archive now locate first instance of
<key>patterns</key> <array>
it should be somewhere within first 50–100 lines
- use code folding to find where according </array> is
- place following right before it
<dict>
<key>comment</key>
<string>colorize everything</string>
<key>match</key>
<string>\b\w+\b</string>
<key>name</key>
<string>colorize</string>
</dict>
or modify the bundled .tmLanguage files, you probably would only need to replace the keywords
Options
Colorcoder allows you to specify white- and blacklist for file-types to highlight: the settings are enabled_for and disabled_for. If enabled_for is present in the config only those file-types will be highlighted, disabled_for wont be highlighted even if present in whitelist.
You can turn the highlighting off per view via View▶Colorcode this view.
Colorcoder also might slow down the editor when highlighting huge files, so it will turn itself off once the file has exceeded the max_size (the check happens when you save the file or reactivate the view). You can force it to highlight the file nevertheless via said menu item (which will read Colorcoding may hurt performance, File is large now)
Contact
You can reach me via email: vprimachenko@ya.ru, twitter: @vprimachenko or visit the official irc channel freenode.net#colorcoder (webchat). If Colorcoder was usefull to you i greatly appreciate a donation via Bitcoin 1DzZ1thGTHubRzoxEeDCJnJZwgFpna6jQk.