Socket
Socket
Sign inDemoInstall

postcss-color

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-color

PostCSS plugin to transform latest W3C CSS color module syntax to more compatible CSS


Version published
Weekly downloads
8
decreased by-92.98%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

postcss-color Build Status

PostCSS plugin to transform latest W3C CSS color module syntax to more compatible CSS.

This plugin can:

Installation

$ npm install postcss-color

Usage

// dependencies
var fs = require("fs")
var postcss = require("postcss")
var color = require("postcss-color")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css
var output = postcss()
  .use(color())
  .process(css)
  .css

Using this input.css:

body {
  background:
    rgb(102, 51, 153)
    linear-gradient(
      color(rebeccapurple a(50%)),
      hwb(0, 20%, 40%),
      color(hwb(0, 20%, 40%, .5) a(+10%)),
      color(#9d9c a(90%))
    )
}

you will get:

body {
  background:
    rgb(102, 51, 153)
    linear-gradient(
      rgba(102, 51, 153, 0.5),
      rgb(153, 51, 51),
      rgba(153, 51, 51, 0.55),
      rgba(153, 221, 153, 0.9)
    )
}

Checkout tests for more examples.

Options

color (default: true)

Allow you to disable transformation of color()

hexAlpha (default: true)

Allow you to disable transformation of #RRGGBBAA or #RGBA

hwb (default: true)

Allow you to disable transformation of hwb()

rebeccapurple (default: true)

Allow you to disable transformation of rebeccapurple


Contributing

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.git
$ git checkout -b patch-1
$ npm install
$ npm test

Changelog

License

Keywords

FAQs

Last updated on 16 Sep 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc