# @nawt/colors

> Various color utilities with color value conversion functions and more

Latest version **0.1.4** (published 2022-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nawt/colors
pnpm add @nawt/colors
yarn add @nawt/colors
bun add @nawt/colors
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2022-01-31 |
| First published | 2022-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 45 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Julian Low <hello@heyjul.es> |
| Maintainers | heyjules |
| Keywords | react, jsx, styled-components, css-in-js, ui, colors |

## Links

- npm: https://www.npmjs.com/package/@nawt/colors
- Repository: https://github.com/heyjul3s/nawt
- Issues: https://github.com/heyjul3s/nawt/issues
- npm.io page: https://npm.io/package/@nawt/colors

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2022-01-31
- 0.1.3 — 2022-01-29
- 0.1.2 — 2022-01-29

## README

# @nawt/colors

A collection of colour value conversion utilities and other colour related functions.

## **API**

### **hexToRgb**(hex: `string`): `string`

This function converts a hex colour value to rgb.

```ts
hexToRgb('#000'); // returns string 'rgb(0, 0, 0)'
```

---

### **hexToRgba**(hex: `string`, alpha: `number`): `string`

Similar to hexToRgb with the difference that this function also returns an alpha value.

```ts
hexToRgba('#000', 0.5); // returns string 'rgba(0, 0, 0, 0.5)'
```

---

### **rgbToHex**(value: `any`): `string`

Converts a RGB colour values to a hex colour value.

```ts
// you can pass in 3 separate numbers each indicating R, G and B respectively as arguments
rgbToHex(97, 58, 136); // returns string '#613a88'

// or your can pass in a single string with a format like 'rgb(111,  147, 11)'
rgbToHex('rgb(111,  147, 11)'); // returns string '#6f930b'
```

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