HEXA Color Format

Converting Hex colors to RGB

This plugin lets you use colors in CSS in hexa() format. With vanilla CSS, this will only work in style tags directly embedded on the page. If you are using EQCSS you can use the hex2rgb() function anywhere to convert hexadecimal colors into RGB format.

How To Use hexa() in Vanilla CSS

The hexa() format allows you to include any hexadecimal encoded color into an rgb color value.

h1 {
  color: hexa(#fff,.8);
  background: hexa(#903,.5);
}

How To Use #rgba in Vanilla CSS

You can also write colors in #rgba format, with four or eight characters like this:

p {
  color: #111c;
}

How To Use hex2rgb() With EQCSS

If you want to use this hex to RGB conversion in external stylesheets, or use hex2rgb() in more places than just where you want to use an rgba() formatted color, you can pair the hex2rgb() function with EQCSS’s eval("") function like this:

@element body {
  :self {
    color: hexa(#000,.8);
    background: rgba(eval("hex2rgb('#999')"),.7);
  }
}

Of course, if you are reading EQCSS from a style tag on the page, you can also make use of hexa() as well.