Sublime Forum

I would love if someone could make me a sublime plugin


I am hoping some amazing sublime plugin developer is available and looking for a new project. I am looking for a code block coloring plugin. The plugin would

  • user could select a block of text and then right click and choosing a color.
  • the background of all of the rows selected would change to the selected color
  • the color would persist when the file is closed
  • the color palettes would be generated from the theme and ish colors ( orangish , bluish , redish etc) that Sublime calculates on the fly based on the color scheme.
  • the default background color is available so it is easy to change the block of text back to the default color.

Thank you so much!!



Something like this ?



Hi @UltraInstinct05
Thank you so much, this is pretty much it!

The only thing I was hoping is that it would color the entire row instead of stopping where the text stopped. Is that possible? That way it could even color empty rows if you selected them.

Thank you so much again.



No, with the current API, you can’t color the space beyond the text itself (atleast I think so). That’s how the API works. Also the plugin doesn’t allow you to color empty rows because anyways empty rows are not selectable.



Here’s the plugin as a Github gist
It’s a slightly non trivial plugin than what I would usually post on this forum, but nonetheless a great starting point for you to actually make this your own & get your feet wet with making plugins.



Thank you so much @UltraInstinct05.
This is very exciting in terms of cleaning my code up! I will check out the git now.



Hi @UltraInstinct05
I got the plugin installed and it shows up in the menu when I right click after selecting text, but all of the colors are greyed out. Do I need to use a specific theme? I checked the console and it seems to have reloaded the plugin fine when I restarted



The colors are greyed out only if the current open view (file) has no file name and you have not selected any text to color. If there are no errors, not immediately sure what might be wrong. What version of ST are you using ? Have you followed the instructions in the gist properly ?

This plugin has nothing to do with your current theme. It only depends on your current color scheme. The ish colors are generated from your current color scheme, which is used to color the regions.



Hi @UltraInstinct05

I did the steps exactly as the gist said and I do see the color blocker in my right click menu.

  • create a folder in my packages called CodeBlockColorer
  • copy, code_block_colorer.sublime-settings, and Context.sublime-menu into that folder
  • then I restarted sublime.

I am using sublime 3.2.2 build 3211.

I am trying it on files that have names and I am selecting blocks of text.



It appears that the secrets module that I was using to generate random region keys was added in Python 3.6 & since you are using 3211 (which ships with Python 3.3 interpreter), it wasn’t working. I have modified the plugin code and removed secrets. Can you try now ? Just get a fresh copy of the plugin file. Rest remains same.



That worked!!
Thank you so much @UltraInstinct05
This is fantastic.