Skip to content package
postcss-color-functional-notation v8.0.7 Use space and slash separated color notation in CSS
node >=20.19.0 5 deps esm open source
overview readme
license MIT-0
deps 5
unpacked 8.3 kB
files 6
node >=20.19.0 $ npm install postcss-color-functional-notation@8.0.7n npmREADME GitHub-flavored package documentation.
downloads Across all versions.
Download trend unavailable.
compatibility Runtime metadata.
keywords Tagged topics.
color comma css design functional hsl hsla hwb notation postcss postcss-plugin rgb
versions Latest published Oct 29, 2026
maintainers Registry package owners.
contents PostCSS Color Functional Notation
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 (
Usage
Add PostCSS Color Functional Notation to your project:
npm install postcss postcss-color-functional-notation --save-dev copy
Use it as a PostCSS plugin:
const postcss = require ( 'postcss' );
const postcssColorFunctionalNotation = require ( 'postcss-color-functional-notation' );
postcss ([
postcssColorFunctionalNotation ( /* pluginOptions */ )
]). process (YOUR_CSS /*, processOptions */ ); copy
Options
preserve
The preserve option determines whether the original notation
is preserved. By default, it is not preserved.
postcssColorFunctionalNotation ({ preserve: true }) copy
: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 (
enableProgressiveCustomProperties
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 to false or if you bring your own fix for Custom Properties.
See what the plugin does in its README .
postcssColorFunctionalNotation ({ enableProgressiveCustomProperties: false }) copy
: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 (
Custom properties do not fallback to the previous declaration
install size Estimated unpacked size across 9 packages.
334.9 kB
Includes dependencies.
dependencies 5 direct dependencies.
alaguna
sombragriselros@gmail.com
179
,
34
,
34
,
0.5
)
;
--firebrick-hsl : hsl ( 0 , 68% , 42% ) ;
--firebrick-hsl-a50 : hsla ( 0 , 68% , 42% , 0.5 ) ;
}
copy
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% ) ;
}
}
copy
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% ) ;
}
copy