# sass-hex-rgb

> A util for converting hex values to rgb (e.g. #302def -> 48, 45, 239)

Latest version **1.0.1** (published 2022-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install sass-hex-rgb
pnpm add sass-hex-rgb
yarn add sass-hex-rgb
bun add sass-hex-rgb
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-08-04 |
| First published | 2021-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | GHOST ghostdevbusiness@gmail.com |
| Maintainers | ghostsos |

## Links

- npm: https://www.npmjs.com/package/sass-hex-rgb
- Repository: https://github.com/ghostdevv/sass-hex-rgb.git
- Homepage: https://github.com/ghostdevv/sass-hex-rgb.git#readme
- Issues: https://github.com/ghostdevv/sass-hex-rgb.git/issues
- npm.io page: https://npm.io/package/sass-hex-rgb

## Recent versions

- 1.0.1 (latest) — 2022-08-04
- 1.0.0-4 (next) — 2021-10-03
- 1.0.0 — 2021-10-03
- 1.0.0-3 — 2021-10-03
- 1.0.0-2 — 2021-10-03
- 1.0.0-1 — 2021-10-03
- 1.0.0-0 — 2021-10-03

## README

# Sass Hex (to) RGB

> This package is compatible with both SASS and SCSS

A way to convert hex values to rgb in sass. The main reason this package exists is to get raw rgb values (e.g. 255, 255, 255) instead of a rgb value wrapped in a function. We also include functions to convert to rgb and rgba.


# Using
```scss
@use 'sass-hex-rgb' as rgb;
```

> Note: depending on how you resolve your sass imports you might need to import from the `node_modules` folder directly, e.g. `./node_modules/sass-hex-rgb`

# Functions

-   `toValues($colour)`
    ```scss
    $red: #f45333;
    $redRGB: rgb.toValues($red); // "244, 83, 51"
    ```

-   `toRGB($colour)`
    ```scss
    $red: rgb.toRGB(#f45333);
    ```

-   `toRGBA($colour)`
    ```scss
    $redAlpha: rgb.toRGBA(#f45333, $alpha: 0.5); // rgba(244, 83, 51, 0.5);
    ```

> Note: I wanted to add `fromValues` as a function, but was unable to as the overhead of splitting the values and converting to a number is large. If anyone has a better idea please submit a [pr](https://github.com/ghostdevv/sass-hex-rgb/pulls)

# Support
-   Join the [discord](https://discord.gg/2Vd4wAjJnm)<br>
-   Create a issue on the [github](https://github.com/ghostdevv/sass-hex-rgb)

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