Skip to content

Commit

Permalink
mention .hex() is lossy (#244)
Browse files Browse the repository at this point in the history
* docs: Add mention of .hex() being lossy

* Update README.md

Co-authored-by: Qix <Qix-@users.noreply.github.com>
  • Loading branch information
maranomynet and Qix- authored Apr 5, 2022
1 parent 0a0f44a commit 957531f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Get the rgb number value.
```js
color.hex() // #ffffff
```
Get the hex value.
Get the hex value. (**NOTE:** `.hex()` does not return alpha values; use `.hexa()` for an RGBA representation)

```js
color.red() // 255
Expand Down
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ it('Translate with channel setters', () => {

it('CSS String getters', () => {
equal(Color('rgb(10, 30, 25)').hex(), '#0A1E19');
equal(Color('rgb(10, 30, 25, .5)').hex(), '#0A1E19');
equal(Color('rgb(10, 30, 25, 1)').hexa(), '#0A1E19FF');
equal(Color('rgb(10, 30, 25, 0.4)').hexa(), '#0A1E1966');
equal(Color('rgb(10, 30, 25, 0)').hexa(), '#0A1E1900');
Expand Down

0 comments on commit 957531f

Please sign in to comment.