# orange-colors

> Orange.Colors - library for working with colors

Latest version **1.0.2** (published 2021-04-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install orange-colors
pnpm add orange-colors
yarn add orange-colors
bun add orange-colors
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-04-15 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Kelner |
| Maintainers | charger88 |
| Keywords | color, rgb, hsv, hex |

## Links

- npm: https://www.npmjs.com/package/orange-colors
- Repository: https://github.com/charger88/orange-color
- Homepage: https://github.com/charger88/orange-color#readme
- Issues: https://github.com/charger88/orange-color/issues
- npm.io page: https://npm.io/package/orange-colors

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-04-15
- 1.0.1 — 2021-03-19

## README

# Orange Colors

Library for working with colors: RGB to HSV and HSV to RGB transformations; color modification by any component. 

## Classes

### OrangeColor

Class instance represents one color and allows to modify and convert it.

Static methods provide color format transformations functionality.
 
| Element | Name | Description | Arguments | Return type |
|---|---|---|---|---|
| constructor |  | Creates color object | `input` |  |
| method | `clone` | Clones object |  | `OrangeColor` |
| property | `hex_string` | Color hex RRGGBB representation |  | `string` |
| property | `html_string` | Color hex RRGGBB representation with starting "#" |  | `string` |
| property | `rgb` | Color HSV (Hue Saturation Value) representation |  | `{"h": number, "s": number, "v": number}` |
| property | `h` | Color hue component |  | `number` |
| property | `s` | Color saturation component |  | `number` |
| property | `v` | Color value component |  | `number` |
| property | `rgb` | Color RGB (Red, Green, Blue) representation |  | `{"r": number, "g": number, "b": number}` |
| property | `r` | Color red component |  | `number` |
| property | `g` | Color green component |  | `number` |
| property | `b` | Color blue component |  | `number` |
| static method | `HEX2RGB` | Converts RRGGBB string to RGB object | `rgb_hex_string` | `{"r": number, "g": number, "b": number}` |
| static method | `RGB2HEX` | Converts RGB object to RRGGBB string | `rgb` | `string` |
| static method | `RGB2HSV` | Converts RGB object to HSV object | `rgb`, `round` | `{"h": number, "s": number, "v": number}` |
| static method | `HSV2RGB` | Converts HSV object to RGB object | `hsv`, `round` | `{"r": number, "g": number, "b": number}` |

## Examples

Let's say you have some color you like. You need to generate few more colors with the same saturation and value (black color component in [HSV model](https://en.wikipedia.org/wiki/HSL_and_HSV)) the same, but use different hue.

```javascript
const {OrangeColor} = require('orange-color')
const my_favorite_color = 'ffb765' 
const color = new OrangeColor(my_favorite_color)
const colors = [my_favorite_color]
for (let i = 0; i < 4; i++){
  color.h += 15
  colors.push(color.hex_string)
}
console.log(colors) // [ 'ffb765', 'ffde66', 'faff66', 'd4ff66', 'adff66' ]
```

---
_Source: https://npm.io/package/orange-colors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
