Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Charbonnel committed Oct 10, 2020
1 parent 1453f40 commit 14daf5a
Showing 1 changed file with 108 additions and 2 deletions.
110 changes: 108 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ Take a look to the test.js file.

import { rgb2hex } from "@ap.cx/hues";

const result = rgb2hex({
r: 1.0,
g: 1.0,
b: 1.0,
});

console.log(result);

> #ffffff

```

### rgba2hex
Expand All @@ -51,6 +61,17 @@ import { rgb2hex } from "@ap.cx/hues";

import { rgba2hex } from "@ap.cx/hues";

const result = rgba2hex({
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0
});

console.log(result);

> #ffffffff

```

### rgb2hsl
Expand All @@ -59,6 +80,20 @@ import { rgba2hex } from "@ap.cx/hues";

import { rgb2hsl } from "@ap.cx/hues";

const result = rgb2hsl({
r: 1.0,
g: 1.0,
b: 1.0,
});

console.log(result);

> {
h: 0,
s: 0,
l: 100,
}

```

Convert {r, g, b } object to { h, s, l} object.
Expand All @@ -69,6 +104,22 @@ Convert {r, g, b } object to { h, s, l} object.

import { rgba2hsla } from "@ap.cx/hues";

const result = rgb2hsl({
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0
});

console.log(result);

> {
h: 0,
s: 0,
l: 100,
a: 1,
}

```

Convert {r, g, b, a } object to { h, s, l, a } object.
Expand All @@ -79,6 +130,59 @@ Convert {r, g, b, a } object to { h, s, l, a } object.

import { relativeLuminance } from "@ap.cx/hues";

const result = relativeLuminance({
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0
});

console.log(result);

> 1

```

### contrast

```js

import { contrast } from "@ap.cx/hues";

const ratio = contrast(relativeLuminance);

console.log(ratio);

> 1

```

### aa

```js

import { aa } from "@ap.cx/hues";

const isAA = aa(ratio); // contrat ratio

console.log(isAA);

> true // or false

```

### aa

```js

import { aa } from "@ap.cx/hues";

const isAAA = aa(ratio); // contrat ratio

console.log(isAAA);

> true // or false

```

### str2rgba
Expand All @@ -93,9 +197,11 @@ Convert css color string to an rgba object of float.

```js

str2rgba('#ffffffff')
const result = str2rgba('#ffffffff')

console.log(result);

{
> {
r: 1.0,
g: 1.0,
b: 1.0,
Expand Down

0 comments on commit 14daf5a

Please sign in to comment.