# @ridwan-p/color-convert

> color converter

Latest version **1.0.9** (published 2022-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ridwan-p/color-convert
pnpm add @ridwan-p/color-convert
yarn add @ridwan-p/color-convert
bun add @ridwan-p/color-convert
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2022-07-09 |
| First published | 2022-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ridwan pamungkas |
| Maintainers | ridwan-p |
| Keywords | color, converter, color converter, color parse, color format |

## Links

- npm: https://www.npmjs.com/package/@ridwan-p/color-convert
- Repository: https://github.com/ridwan-p/color-convert
- Homepage: https://github.com/ridwan-p/color-convert#readme.md
- npm.io page: https://npm.io/package/@ridwan-p/color-convert

## Recent versions

- 1.0.9 (latest) — 2022-07-09
- 1.0.8 — 2022-07-09
- 1.0.7 — 2022-06-23
- 1.0.6 — 2022-06-23
- 1.0.5 — 2022-06-23
- 1.0.4 — 2022-06-23
- 1.0.3 — 2022-06-23
- 1.0.2 — 2022-06-23
- 1.0.1 — 2022-06-23
- 1.0.0 — 2022-06-22

## README

# Color Convert

Color Convert is a color conversion library for JavaScript and node.
It converts all ways between `rgb`, `hsl`, `hsv`, `hex` strings, and generate the oposite color (invert color):

# Install

```console
$ npm i @ridwan-p/color-convert
```
## Usage

```js
const color = require("@ridwan-p/color-convert")

// Hexa to RGB
color.hex2RGB('#FFF')
//=> { r: 255, g: 255, b: 255 }

// RGB to Hexa
color.rgb2Hex(255, 12, 43)
//=> #ff0c2b

// Generate the oposite color
color.invertColor('#ffff00')
//=> #ff0c2b
// set black & white
color.invertColor('#ffff00', true)
//=> #000000

// Convert to HSL
color.rgb2HSL(255, 66, 66)
color.hex2HSL('#ff4242')
//=> { h: 0, s: 1, l: 0.6294117647058823 }

// Convert to HSV
color.rgb2HSL(255, 66, 66)
color.hex2HSL('#ff4242')
//=> { h: 0, s: 0.7411764705882353, v: 1 }

```

# Contribute

If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.

# License
Copyright &copy; 2022, Ridwan Pamungkas.

Licensed under the [MIT License](LICENSE)

---
_Source: https://npm.io/package/@ridwan-p/color-convert · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
