I wanted to add to this thread since much has changed since 2012. Docstrings are now colored like comments which is what this thread’s OP was looking for. Also, according the following post, this is aligned with how all other languages are handled:
As was mentioned later in that thread, if one wants to change this behavior without digging into and modifying the default syntax and color scheme, just customize the color scheme. Sublime has its own configuration file and syntax for that. No need to use
.tmTheme. Just go to the Sublime Text menu and select Preferences then “Customize Color Scheme”. This reveals an editor showing the default settings for the color scheme on the left and an empty user color scheme on the right.
To change how docstrings are highlighted, just add an entry to the list of
rules. The following will change the docstrings to look like all other strings. Some people prefer this. You can also change the color that it uses by looking at the list of available colors in
variables in the default color scheme. You may pick any of those colors to suit you. If you don’t like those colors, you can add a new color to the user color scheme
variables. You would then choose a variable name that is not already used and then define a color there. That variable name would then be entered in the
foreground field of your custom rule.
Note: I am using Monokai color scheme in this example, but you can use whichever one you like, the variable you use in the
foreground field may then be different.
To access the default syntax definitions, open the command palette, and run “View Package File”. In the next popup, type “Python/” to view the contents of the default Python package. You will see “Python/Python-sublime-syntax” listed. Select it and you will then have the file with all the scopes that you need open in a new tab. (Updated from previous; thanks @FichteFoll)
If you want to have docstrings that are still “commenty” but also different than other comments, I add a new color called
grellow to the user
variables like so.
"grellow": "hsl(60, 60%, 30%)"
You would then change the
foreground field in the
rules definition to