Sublime Forum

Can I change my background color based on the directory I am in?

#1

I do this for my terminal windows, and I’d love to make my editor windows match. When I am ‘in’ a particular directory tree (such as a particular GIT enlistment), I’d like to have my workplace color-coded to match. This helps me keep work distinct in different GIT enlistments. For Sublime Text, that would mean color-coding the editor text background color depending on where the file being edited exists.

Has this been done? If not, is it a project that a Sublime Text novice could take on?

0 Likes

#2

The background color is controlled by the color scheme. You could write a pretty simple Python plugin to switch color schemes based on the folder that contains the current file.

You’d probably want to use sublime_plugin.EventListener() as your base and implement on_activated(view), then use the view object to get the settings and change the color scheme if it is in a folder you recognize.

1 Like

#3

I recently reviewed a package that could help you with this: https://packagecontrol.io/packages/SuperSettings

1 Like