Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
postcss-color-function
Advanced tools
PostCSS plugin to transform W3C CSS color function to more compatible CSS.
PostCSS plugin to transform W3C CSS color function to more compatible CSS.
$ npm install postcss-color-function
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var colorFunction = require("postcss-color-function")
// css to be processed
var css = fs.readFileSync("input.css", "utf8")
// process css
var output = postcss()
.use(colorFunction())
.process(css)
.css
Using this input.css
:
body {
background: color(red a(90%))
}
you will get:
body {
background: rgba(255, 0, 0, 0.9)
}
Checkout tests for examples.
color( [ <color> | <hue> ] <color-adjuster>* )
color-adjuster
[red( | green( | blue( | alpha( | a(] ['+' | '-']? [<number> | <percentage>] )
[red( | green( | blue( | alpha( | a(] '*' <percentage> )
rgb( ['+' | '-'] [<number> | <percentage>]{3} )
rgb( ['+' | '-'] <hash-token> )
rgb( '*' <percentage> ) |
[hue( | h(] ['+' | '-' | '*']? <angle> )
[saturation( | s(] ['+' | '-' | '*']? <percentage> )
[lightness( | l(] ['+' | '-' | '*']? <percentage> )
[whiteness( | w(] ['+' | '-' | '*']? <percentage> )
[blackness( | b(] ['+' | '-' | '*']? <percentage> )
tint( <percentage> )
shade( <percentage> )
blend( <color> <percentage> [rgb | hsl | hwb]? )
blenda( <color> <percentage> [rgb | hsl | hwb]? )
contrast( <percentage>? )
Notes:
Read the specs for more information.
whatever {
color: color(red a(10%);
background-color: color(red lightness(50%)); /* == color(red l(50%)); */
border-color: color(hsla(125, 50%, 50%, .4) saturation(+ 10%) w(- 20%));
}
currentcolor
so we can do color(currentcolor adjuster())
?No we cannot do that. currentcolor
depends on the cascade (so the DOM) and we can't handle that in a simple preprocessing step. You need to handle that with polyfills.
color(var(--mainColor) adjuster())
?By using postcss-custom-properties before this plugin, you can do that (sort of). You have some examples in cssnext playground.
Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
$ git clone https://github.com/postcss/postcss-color-function.git
$ git checkout -b patch-1
$ npm install
$ npm test
1.2.0 - 2015-03-12
FAQs
PostCSS plugin to transform W3C CSS color function to more compatible CSS.
The npm package postcss-color-function receives a total of 280,702 weekly downloads. As such, postcss-color-function popularity was classified as popular.
We found that postcss-color-function demonstrated a not healthy version release cadence and project activity because the last version was released 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.