postcss-color-hex-alpha

Use 4 & 8 character hex color notation in CSS

MIT 25 个版本
安装
npm install postcss-color-hex-alpha
yarn add postcss-color-hex-alpha
pnpm add postcss-color-hex-alpha
bun add postcss-color-hex-alpha
README

PostCSS Color Hex Alpha PostCSS Logo

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 */);

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;
}
版本列表
11.0.0 2026-01-14
10.0.0 2024-08-03
9.0.4 2024-02-19
9.0.3 2023-12-15
9.0.2 2023-02-06
9.0.1 2023-01-28
9.0.0 2023-01-24
8.0.4 2022-06-10
8.0.3 2022-02-05
8.0.2 2022-01-02
8.0.1 2021-12-16
8.0.0 2021-09-22
7.0.0 2021-01-12
6.0.0 2020-04-25
5.0.3 2019-03-30
5.0.2 2018-09-18
5.0.1 2018-09-18
5.0.0 2018-09-18
4.0.0 2018-09-18
3.0.0 2017-05-15
2.0.0 2015-09-08
1.3.0 2015-08-13
1.2.0 2014-11-25
1.1.0 2014-11-25
1.0.0 2014-10-04