Sublime Text 2/3 package for converting CSS hexadecimal colors into RGBA. This fixes and extends aroscoe's original ST2 only plugin.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 19 commits ahead of aroscoe:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Default (Linux).sublime-keymap
Default (OSX).sublime-keymap
Default (Windows).sublime-keymap
Main.sublime-menu
README.md
color_converters.py
color_converters.sublime-commands

README.md

Hex-to-RGBA

Sublime Text 2/3 package for converting CSS hexadecimal colors to/from RGBA.

Installation

Download/clone into your Sublime Text 2 or 3 package directory.

Usage

Hex to RGBA

  1. Select the hexadecimal value (e.g. #ABCDEF, ABCDEF, #FFF, or 127)
  2. 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)

RGB(A) to Hex

  1. Select the RGB/RGBA function-call (e.g. rgba(255, 125, 0, 0.5), or rgb(0, 125, 255))
  2. Use the "RGB(A) to Hex" tool to convert this rgba tuple to an equivalent Hex representation (#RRGGBB)

Convert Color: ub (0-255) to Float

  1. Select an RGB color value (expressed as an unsigned byte - i.e. 0 to 255), not including whitespace or commas/parens.
  2. Use the "Convert Color: 0-255 to Float" tool to convert this to a floating-point (0.0-1.0) representation of this value

Convert Color: Float to ub (0-255)

  1. Select an RGB color value (expressed a float from 0.0 to 1.0), not including whitespace or commas/parens
  2. Use the "Convert Color: Float to 0-255" tool to convert this to an unsigned byte (0-255) value

Menu options

The tools can be accessed from the "Edit" > "Color Conversion Tools" submenu.

Keyboard shortcuts

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

Command Palette

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.

Credit

This package is a fork of the original "Hex-to-RGBA" package by aroscoe, with substantial modifications by @Aligorith