@chriscodesthings/css-hex-color-to-rgba

1.0.0 • Public • Published

css-hex-color-to-rgba · Test workflow status NPM Version License: MIT

Converts a CSS hex color code to RGBA values

Install

npm install --save @chriscodesthings/css-hex-color-to-rgba

Use

import hexColorToRGBA from '@chriscodesthings/css-hex-color-to-rgba';

console.log(hexColorToRGBA("#6495ed"));
// => [ 100, 149, 237 ]

Syntax

hexColorToRGBA(col);

Parameters

  • col: a CSS hex color code

Return Value

Array containing the R, G, B and A values of col.

Description

Converts a CSS hex color to RGBA values.

  • R, G, and B range from 0 to 255
  • A ranges from 0 to 1

Accepts CSS hex color codes in any form.

Readme

Keywords

Package Sidebar

Install

npm i @chriscodesthings/css-hex-color-to-rgba

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.4 kB

Total Files

6

Last publish

Collaborators

  • chriscodesthings