Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCodesThings committed May 1, 2024
1 parent 3bf44da commit e2b49da
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# css-hex-color-to-rgba · [![Test workflow status](https://github.com/ChrisCodesThings/css-hex-color-to-rgba/actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml) [![NPM Version](https://img.shields.io/npm/v/@chriscodesthings/css-hex-color-to-rgba)](https://www.npmjs.com/package/@chriscodesthings/css-hex-color-to-rgba) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
# css-hex-color-to-rgba <br> [![Test workflow status](https://github.com/ChrisCodesThings/css-hex-color-to-rgba/actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml) [![NPM Version](https://img.shields.io/npm/v/@chriscodesthings/css-hex-color-to-rgba)](https://www.npmjs.com/package/@chriscodesthings/css-hex-color-to-rgba) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

> **Converts a CSS hex color code to RGBA values**
## Description

Converts a CSS hex color code to an array containing red, green, blue and alpha values.

### See...
- [Install/Usage](#install "Install and Usage")
- [Syntax](#syntax "Syntax")
- [Examples](#examples "Examples")
- [See Also](#see-also "See Also")

---

## Install

```sh
Expand All @@ -11,16 +23,16 @@ npm install --save @chriscodesthings/css-hex-color-to-rgba
## Use

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

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

## Syntax

```js
hexColorToRGBA(color);
cssHexColorToRGBA(color);
```

### Parameters
Expand All @@ -34,6 +46,16 @@ Returns an array containing the `[red, green, blue, alpha]` values of *color*.
Red, green and blue values are in the range 0-255.
Alpha value is in the range 0-1.

## Description
## Examples

```js
// switch colour to rgba
const rgba = cssHexColorToRGBA(color);
```

## See Also...

Does what it says on the tin.
- [**rgba-color-to-css-hex**: Converts an RGB or RGBA color to a CSS hex color code](https://github.com/ChrisCodesThings/rgba-color-to-css-hex "Converts an RGB or RGBA color to a CSS hex color code")
- [**random-css-hex-color**: Generates a random color in CSS hex format](https://github.com/ChrisCodesThings/random-css-hex-color "Generates a random color in CSS hex format")
- [**is-css-hex-color**: Determine if a string is a CSS hex color code](https://github.com/ChrisCodesThings/is-css-hex-color "Determine if a string is a CSS hex color code")
- [**color-object**: Simple, lightweight class to store and manipulate a color, and convert between formats](https://github.com/ChrisCodesThings/color-object "Simple, lightweight class to store and manipulate a color, and convert between formats")

0 comments on commit e2b49da

Please sign in to comment.