1. postcss-color-hex-alpha
Use 4 & 8 character hex color notation in CSS
postcss-color-hex-alpha
Package: postcss-color-hex-alpha
Created by: csstools
Last modified: Mon, 19 Feb 2024 08:03:42 GMT
Version: 9.0.4
License: MIT
Downloads: 25,482,771
Repository: https://github.com/csstools/postcss-plugins

Install

npm install postcss-color-hex-alpha
yarn add postcss-color-hex-alpha

PostCSS Color Hex Alpha PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

 npm install postcss-color-hex-alpha --save-dev

PostCSS Color Hex Alpha lets you use 4 & 8 character hex color notation in
CSS, following the CSS Color Module specification.

body {
	background: #9d9c;
}

/* becomes */

body {
	background: rgba(153,221,153,0.8);
}

Usage

Add PostCSS Color Hex Alpha to your project:

 npm install postcss postcss-color-hex-alpha --save-dev

Use it as a PostCSS plugin:

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

postcss([
	postcssColorHexAlpha(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS Color Hex Alpha runs in all Node environments, with special
instructions for:

Options

preserve

The preserve option determines whether the original notation
is preserved. By default, it is not preserved.

 postcssColorHexAlpha({ preserve: true })
body {
	background: #9d9c;
}

/* becomes */

body {
	background: rgba(153,221,153,0.8);
	background: #9d9c;
}

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code