ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Hex to HSL Color Converter

by atadams ALL

Sublime Text 2/3 plugin to convert CSS Hex colors to HSL.

Details

  • 2017.04.20.14.18.37
  • github.​com
  • github.​com
  • 7 years ago
  • 46 minutes ago
  • 12 years ago

Installs

  • Total 24K
  • Win 17K
  • Mac 5K
  • Linux 2K
Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13
Windows 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
Linux 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

About

Adds commands to Sublime Text that converts RGB colors, in either hex or RGB() format, to HSL colors. For example:

  • #bada55 becomes hsl(74, 64%, 59%)
  • rgb(75, 96, 6) becomes hsl(74, 88%, 20%)
  • rgba(117, 149, 9, 0.65) becomes hsla(74, 89%, 31%, 0.65)

In the past, due to browser (IE) compatibility, it was best to use a CSS preprocessor to convert the HSL colors to hex. But now all major browsers support HSL color, including IE9+, so you can use HSL colors in CSS unless you need to support IE8.

Installation

You can install using Package Control or you can download or clone the repository and drop it into your Sublime Text packages directory.

Version 2 Features

  • Version 2 now converts hex and RGB to HSL and RGBA to HSLA. The previous version only converted hex to HSL.
  • Optionally, you can convert hex, RGB, and RGBA to HSLA (force alpha).
  • You can now convert all hex, RGB, and RGBA colors in a file by inputting the following command twice: (shift+ctrl+U).

Usage

  • Convert Selected to HSL: shift+ctrl+U
  • Convert Selected to HSLA: shift+ctrl+alt+U
  • Convert All to HSL (preserving alpha): shift+ctrl+U + shift+ctrl+U
  • Convert All to HSLA (force alpha): shift+ctrl+alt+U + shift+ctrl+alt+U

Why No Hex/HSL to RGB support

HSL color is just better than hex or RGB (Brandon Mathis gives a good explanation why HSL rocks). I don't see any use for RGB—HSL is just more intuitive and makes it much easier to combine colors into a logical color scheme.

If you have the need to convert to RGB, you might try the CSS Color Converter plugin.

HSL Resources

If you need more convincing about HSL, try these: