
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@csstools/postcss-alpha-function
Advanced tools
npm install @csstools/postcss-alpha-function --save-dev
PostCSS Alpha Function lets you use the alpha function in
CSS, following the CSS Color specification.
.color {
color: alpha(from #dddd / calc(alpha / 2));
}
:root {
--a-color: alpha(from rgb(2 1 0 / var(--a)) / calc(alpha / 2));
}
/* becomes */
.color {
color: rgb(from #dddd r g b / calc(alpha / 2));
}
:root {
--a-color: rgb(from rgb(2 1 0 / var(--a)) r g b / calc(alpha / 2));
}
Add PostCSS Alpha Function to your project:
npm install postcss @csstools/postcss-alpha-function --save-dev
Use it as a PostCSS plugin:
const postcss = require('postcss');
const postcssAlphaFunction = require('@csstools/postcss-alpha-function');
postcss([
postcssAlphaFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
The preserve option determines whether the original notation
is preserved. By default, it is not preserved.
postcssAlphaFunction({ preserve: true })
.color {
color: alpha(from #dddd / calc(alpha / 2));
}
:root {
--a-color: alpha(from rgb(2 1 0 / var(--a)) / calc(alpha / 2));
}
/* becomes */
.color {
color: rgb(from #dddd r g b / calc(alpha / 2));
color: alpha(from #dddd / calc(alpha / 2));
}
:root {
--a-color: rgb(from rgb(2 1 0 / var(--a)) r g b / calc(alpha / 2));
}
@supports (color: alpha(from red / 1)) and (color: rgb(0 0 0 / 0)) {
:root {
--a-color: alpha(from rgb(2 1 0 / var(--a)) / calc(alpha / 2));
}
}
The enableProgressiveCustomProperties option determines whether the original notation
is wrapped with @supports when used in Custom Properties. By default, it is enabled.
[!NOTE] We only recommend disabling this when you set
preservetofalseor if you bring your own fix for Custom Properties.
See what the plugin does in its README.
postcssAlphaFunction({ enableProgressiveCustomProperties: false })
.color {
color: alpha(from #dddd / calc(alpha / 2));
}
:root {
--a-color: alpha(from rgb(2 1 0 / var(--a)) / calc(alpha / 2));
}
/* becomes */
.color {
color: rgb(from #dddd r g b / calc(alpha / 2));
color: alpha(from #dddd / calc(alpha / 2));
}
:root {
--a-color: rgb(from rgb(2 1 0 / var(--a)) r g b / calc(alpha / 2));
--a-color: alpha(from rgb(2 1 0 / var(--a)) / calc(alpha / 2));
}
Custom properties do not fallback to the previous declaration
This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/tree/main/css-color-4. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
postcss-color-function is a PostCSS plugin that allows you to transform CSS colors using functions like color(), which can adjust lightness, saturation, and more. While it offers broader color manipulation capabilities, @csstools/postcss-alpha-function focuses specifically on adjusting alpha transparency.
postcss-color-mod-function is another PostCSS plugin that provides a color-mod() function for modifying colors. It supports a wide range of color adjustments, including alpha transparency, similar to @csstools/postcss-alpha-function, but with additional capabilities for other color properties.
FAQs
Use the alpha() function in CSS
The npm package @csstools/postcss-alpha-function receives a total of 955,637 weekly downloads. As such, @csstools/postcss-alpha-function popularity was classified as popular.
We found that @csstools/postcss-alpha-function demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
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.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.