Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-color-hex-alpha

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-color-hex-alpha

Use 4 & 8 character hex color notation in CSS

  • 10.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is postcss-color-hex-alpha?

The postcss-color-hex-alpha package is a PostCSS plugin that allows you to use 4- and 8-digit hex color notation in your CSS. This notation includes an alpha channel, which specifies the opacity of the color. The plugin converts these hex colors into their equivalent rgba() or hsla() functions, making it easier to work with colors that include transparency.

What are postcss-color-hex-alpha's main functionalities?

Convert 4-digit hex colors to rgba()

This feature allows you to use 4-digit hex colors (e.g., #0f08) in your CSS. The plugin converts these colors into their rgba() equivalents, making it easier to work with colors that include transparency.

const postcss = require('postcss');
const colorHexAlpha = require('postcss-color-hex-alpha');

const css = 'a { color: #0f08; }';

postcss([colorHexAlpha]).process(css).then(result => {
  console.log(result.css);
  // Output: 'a { color: rgba(0, 255, 0, 0.53); }'
});

Convert 8-digit hex colors to rgba()

This feature allows you to use 8-digit hex colors (e.g., #0000ff80) in your CSS. The plugin converts these colors into their rgba() equivalents, making it easier to work with colors that include transparency.

const postcss = require('postcss');
const colorHexAlpha = require('postcss-color-hex-alpha');

const css = 'a { color: #0000ff80; }';

postcss([colorHexAlpha]).process(css).then(result => {
  console.log(result.css);
  // Output: 'a { color: rgba(0, 0, 255, 0.5); }'
});

Other packages similar to postcss-color-hex-alpha

Keywords

FAQs

Package last updated on 03 Aug 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc