Socket
Socket
Sign inDemoInstall

emotion-rgba

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    emotion-rgba

Sass style rgba function for emotion css


Version published
Weekly downloads
17K
decreased by-14.85%
Maintainers
1
Install size
39.3 kB
Created
Weekly downloads
 

Readme

Source

Emotion RGBA

License 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:

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-icd11q {
    background-color: rgba(255, 105, 180, 0.5);
}

Standard HTML color strings are also supported, for example:

const StyledComponent = styled.div`
    background-color: ${rgba('red', 0.8)};
`;

Keywords

FAQs

Last updated on 25 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc