Creating Themes

Theme Icon

Daniel Käsmayr got the ball rolling on improving the life of custom theme developers. He outlined a theme creation tool/workflow which made me write a command to extract all scope names declared by the current language (plus all languages which can be embedded in that.)

It creates a new theme using these scope names, which can then serve as a starting point.

It provides random foreground colors for all the rules in the theme, and switches to this newly created theme, making it a fun little “give me a randomly generated theme” command.

Despite creating this command, the point is not to target a specific language when creating a theme. There are naming conventions for scopes and scope names are hierarchical to cater for inheritance as argued in the linked to letter.

To try it out, first download the Theme Builder bundle and install it by double-clicking it (after extracting the archive.) This will give you a new entry in the gear menu (reachable from the status bar) with a Theme Builder sub-menu which has one command: “Create for Current Language.” Selecting it should then generate a new theme and switch to that. Go to Preferences → Fonts & Colors to inspect and modify the theme.

The command removes the language suffix from the scope names, which should make the generated theme of general use.

For the records, all custom themes are stored in ~/Library/Application Support/TextMate/Themes. You can find lots of user submitted themes at the wiki.