Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
postcss-color-functional-notation
Advanced tools
Use space and slash separated color notation in CSS
Weekly downloads
Readme
npm install postcss-color-functional-notation --save-dev
PostCSS Color Functional Notation lets you use space and slash separated color notation in CSS, following the CSS Color specification.
:root {
--firebrick: rgb(178 34 34);
--firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
--firebrick-hsl: hsla(0 68% 42%);
--firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}
/* becomes */
:root {
--firebrick: rgb(178, 34, 34);
--firebrick-a50: rgba(179, 34, 34, 0.5);
--firebrick-hsl: hsl(0, 68%, 42%);
--firebrick-hsl-a50: hsla(0, 68%, 42%, 0.5);
}
Add PostCSS Color Functional Notation to your project:
npm install postcss postcss-color-functional-notation --save-dev
Use it as a PostCSS plugin:
const postcss = require('postcss');
const postcssColorFunctionalNotation = require('postcss-color-functional-notation');
postcss([
postcssColorFunctionalNotation(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
PostCSS Color Functional Notation runs in all Node environments, with special instructions for:
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
postcssColorFunctionalNotation({ preserve: true })
:root {
--firebrick: rgb(178 34 34);
--firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
--firebrick-hsl: hsla(0 68% 42%);
--firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}
/* becomes */
:root {
--firebrick: rgb(178, 34, 34);
--firebrick-a50: rgba(179, 34, 34, 0.5);
--firebrick-hsl: hsl(0, 68%, 42%);
--firebrick-hsl: hsla(0 68% 42%);
--firebrick-hsl-a50: hsla(0, 68%, 42%, 0.5);
}
@supports (color: rgb(0 0 0 / 0)) {
:root {
--firebrick: rgb(178 34 34);
--firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
}
}
@supports (color: hsl(0 0% 0% / 0)) {
:root {
--firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}
}
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
preserve
tofalse
or if you bring your own fix for Custom Properties.
See what the plugin does in its README.
postcssColorFunctionalNotation({ enableProgressiveCustomProperties: false })
:root {
--firebrick: rgb(178 34 34);
--firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
--firebrick-hsl: hsla(0 68% 42%);
--firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}
/* becomes */
:root {
--firebrick: rgb(178, 34, 34);
--firebrick: rgb(178 34 34);
--firebrick-a50: rgba(179, 34, 34, 0.5);
--firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
--firebrick-hsl: hsl(0, 68%, 42%);
--firebrick-hsl: hsla(0 68% 42%);
--firebrick-hsl-a50: hsla(0, 68%, 42%, 0.5);
--firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}
Custom properties do not fallback to the previous declaration
FAQs
Use space and slash separated color notation in CSS
The npm package postcss-color-functional-notation receives a total of 4,722,883 weekly downloads. As such, postcss-color-functional-notation popularity was classified as popular.
We found that postcss-color-functional-notation 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.