The scopes are actually the easiest part of this equation.
The basic outline is this: manual.macromates.com/en/language_grammars
Use ScopeHunter to get the scope under the cursor:
github.com/facelessuser/ScopeHunter
(There are other options out there, but SH is a must for designing color schemes.)
Now, creating color schemes for Sublime/TextMate/etc. is a massive hassle because writing in the defualt PLIST (an XML format, basically) is a PITA.
To alleviate this you can use SerializedDataConverter to write the scheme in JSON or YAML and convert it to PLIST:
github.com/facelessuser/SerializedDataConverter
There’s a new plugin that allows you to write in CSS or Sass and convert to PLIST:
github.com/FichteFoll/CSScheme/
I think using Sass is a good solution, because it’s readable and allows functions to tweak colors.
I have converted a theme I’ve been using for a few years now to Sass and am in the process of abstracting it, so it can be used as a base for others. It’s not very well documented yet, but I’m actively developing it, and it might help you in your own explorations:
github.com/alehandrof/Writerly/
If you understand Sass the “_better_base.scss” file contains the guts of the scheme:
github.com/alehandrof/Writerly/ … -base.scss
It will give you a good sense of what the common scopes are – the scheme was originally based on the default ST2/3 scheme (Monokai).
And, in case it’s useful, this is the same scheme (more or less) in JSON:
github.com/alehandrof/Writerly/ … Theme.JSON
Hope this helps,
Alex