
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
postcss-color-hsla-fallback
Advanced tools
PostCSS plugin to transform hsl() and hsla() to hexadecimal
PostCSS plugin to transform hsl()
and hsla()
to hexadecimal.
Inspiration for this plugin comes from postcss-color-rgba-fallback
With npm:
npm install postcss-color-hsla-fallback --save-dev
or with yarn:
yarn add postcss-color-hsla-fallback --dev
Also make sure you have postcss
installed:
npm install postcss --save-dev
yarn add postcss --dev
const fs = require('fs');
const postcss = require('postcss');
const colorHslaFallback = require('postcss-color-hsla-fallback');
const css = fs.readFileSync('input.css', 'utf8');
const output = postcss()
.use(colorHslaFallback())
.process(css)
.css;
Using this input.css
:
body {
color: hsl(0, 53%, 41%);
}
you will get:
body {
color: #a03131;
color: hsl(0, 53%, 41%);
}
preserve
(default: true
)Allows you to preserve the original hsl()
or hsla()
colors in the output.
Possible values:
true
: Keeps hsl()
and hsla()
values in the output.false
: Removes hsl()
and hsla()
values from the output and replaces them with their hex computed values.With preserve: false
you will get:
body {
color: #a03131;
}
skipProperties
(default: '[]`)Allows you to skip specific properties from the list so that they are not replaced with their hex computed values.
Possible values includes one or more from this list:
[
'background-color',
'background',
'border-bottom-color',
'border-color',
'border-left-color',
'border-right-color',
'border-top-color',
'border',
'caret-color',
'color',
'column-rule-color',
'column-rule',
'filter',
'outline-color',
'outline',
'text-decoration-color',
'text-shadow'
]
This plugin requires postcss
v8+.
npm run test
or yarn test
.npm run lint
or yarn lint
.For details, check out the Contributing guide.
MIT
FAQs
PostCSS plugin to transform hsl() and hsla() to hexadecimal
We found that postcss-color-hsla-fallback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.