Today I'm announcing the first release of a new plugin for Sublime Text
3 (ST2 untested, but may well be supported too, *fingers crossed*) that makes it easier to work with various colour representations in code. As anyone who spends any time working with various colour pickers and colour-related API's on different platforms knows, at some point you're going to have to convert your colours from one representation to another for some reason, and then you suddenly have to waste heaps of time converting and transcribing colour values between different representations. Clearly this can be optimised (we're using modern text editors for goodness sakes!) So, without further ado, the plugin can be found at the following Github repo:
Key Features:
* Convert Hex (i.e.
#RRGGBB) color representation to a RGBA tuple (i.e.
rgba(0-255, 0-255, 0-255, 0-1))
* Convert RGB(A) tuple (i.e. rgba(0-255, 0-255, 0-255, 0-1) OR rgb(0-255, 0-255, 0-255)) to Hex (i.e. #RRGGBB)
* Convert individual colour values from 0-255 (unsigned byte) values to/from float (0.0-1.0) values
* Accessible from menus (shown in screenshot), using hotkeys (shown in screenshot too:
Ctrl-Shift-R for "
Convert to rgba", and
Ctrl-Shift-H for "
Convert to hex"), and from the command palette (
Ctrl-Shift-P - I recommend searching for "
hex" or "
ub")
EDIT (20180215): I've just tested it in Sublime Text 2, and it also works there. So, it's safe to say that it works on both now :)