Sublime Text 2/3 package for converting CSS hexadecimal colors to/from RGBA.
Download/clone into your Sublime Text 2 or 3 package directory.
- Select the hexadecimal value (e.g.
#ABCDEF
,ABCDEF
,#FFF
, or127
) - Use the "Hex to RGBA" tool to convert this hex value to an equivalent RGBA representation
(
r = 0-255, g = 0-255, b = 0-255, a = 0.0-1.0
)
- Select the RGB/RGBA function-call (e.g.
rgba(255, 125, 0, 0.5)
, orrgb(0, 125, 255)
) - Use the "RGB(A) to Hex" tool to convert this rgba tuple to an equivalent Hex representation (
#RRGGBB
)
- Select an RGB color value (expressed as an unsigned byte - i.e. 0 to 255), not including whitespace or commas/parens.
- Use the "Convert Color: 0-255 to Float" tool to convert this to a floating-point (0.0-1.0) representation of this value
- Select an RGB color value (expressed a float from 0.0 to 1.0), not including whitespace or commas/parens
- Use the "Convert Color: Float to 0-255" tool to convert this to an unsigned byte (0-255) value
The tools can be accessed from the "Edit" > "Color Conversion Tools" submenu.
OS | Hex to RGBA | RGB(A) to Hex |
---|---|---|
Windows | Shift-Ctrl-R | Shift-Ctrl-H |
Linux | Shift-Ctrl-R | Shift-Ctrl-H |
Mac | Shift-Cmd-R | Shift-Cmd-H |
The tools can be accessed from the command palette by searching for "hex" and selecting either the "Convert: Hex to RGBA" or "Convert: RGB(A) to Hex" options as appropriate.
This package is a fork of the original "Hex-to-RGBA" package by aroscoe, with substantial modifications by @Aligorith