Sublime Forum

Set color of status bar from plugin

#1

I want to set the color (background and foreground) of the status bar from a plugin, but I can’t find a way to do that. Is it possible?

0 Likes

#2

I believe you can theme the complete application. Not just portions of.

0 Likes

#3

You may copy your current theme and then change the status bar portion.
Current chrome theme is the value of the preference ‘theme’, such “theme”: “Soda Dark.sublime-theme”,

0 Likes

#4

I want to control the color from a plugin, so that I can set the status bar to either red or green color depending on the outcome of my executed unit tests.

0 Likes

#5

You can parse the json of the theme with python, and then set the rgb color of the relevant part, and save it.
I’m not sure if sublime will monitor the file and pick the changes.
Soda theme contains comments about the status bar. Check the source.

0 Likes

#6

[quote=“tito”]You can parse the json of the theme with python, and then set the rgb color of the relevant part, and save it.
I’m not sure if sublime will monitor the file and pick the changes.
Soda theme contains comments about the status bar. Check the source.[/quote]

Yep, this should be doable. You could strip the comments and use the json module which is the easiest, but you will obliterate the comments. Or you could just parse the file with good old regex to find the option as well.

If you are changing the status background and it is a png you can probably just redirect it to a different red or green png.

0 Likes

#7

Thanks, this looks like it could work.

0 Likes