# emotion-rgba

> Sass style rgba function for emotion css

Latest version **0.0.12** (published 2023-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install emotion-rgba
pnpm add emotion-rgba
yarn add emotion-rgba
bun add emotion-rgba
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2023-08-25 |
| First published | 2019-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 39.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Chris Baker |
| Maintainers | chris-baker |
| Keywords | Emotion, CSS, RGBA |

## Links

- npm: https://www.npmjs.com/package/emotion-rgba
- Repository: https://github.com/Chris-Baker/Emotion-RGBA
- Homepage: https://github.com/Chris-Baker/Emotion-RGBA#readme
- Issues: https://github.com/Chris-Baker/Emotion-RGBA/issues
- npm.io page: https://npm.io/package/emotion-rgba

## 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.0.12 (latest) — 2023-08-25
- 0.0.11 — 2022-05-14
- 0.0.10 — 2022-05-13
- 0.0.9 — 2021-03-31
- 0.0.8 — 2019-08-12
- 0.0.7 — 2019-08-12
- 0.0.6 — 2019-08-12
- 0.0.5 — 2019-08-12
- 0.0.4 — 2019-08-11
- 0.0.3 — 2019-08-09
- 0.0.2 — 2019-08-09
- 0.0.1 — 2019-08-09

## README

# Emotion RGBA
[![License][license-image]][license-url] ![coverage-badge-green]

[Emotion] does not currently support the Sass rgba function syntax of `rgba($color, $alpha)` out of the box.

To remedy this, Emotion RGBA is a simple helper function which can be called from a styled component or css block and returns a valid css rgba color string. 

For example:

```js
import styled from '@emotion/styled';
import { rgba } from 'emotion-rgba';

// define a color for our theme
const hotPink = '#ff69b4';
const alpha = 0.5;

// create a styled component and use our color
const StyledComponent = styled.div`
    background-color: ${rgba(hotPink, alpha)};
`;
```
Outputs the css:
```css
.css-icd11q {
    background-color: rgba(255, 105, 180, 0.5);
}
```
Standard HTML color strings are also supported, for example:
```js
const StyledComponent = styled.div`
    background-color: ${rgba('red', 0.8)};
`;
```

[Emotion]: https://github.com/emotion-js/emotion
[coverage-badge-green]: https://img.shields.io/badge/Coverage-100%25-brightgreen.svg
[license-url]: https://opensource.org/licenses/MIT
[license-image]: https://img.shields.io/npm/l/make-coverage-badge.svg

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