Giter Club home page Giter Club logo

postcss-color's Introduction

DEPRECATED

This module have been exploded into several plugins

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

postcss-color's People

Contributors

moox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

postcss-color's Issues

rgba converted to IE AARRGGBB

rgba(37,87,177,0.5) โ†’ #7F 25 57 B1

.foo {
   background:rgba(37,87,177,0.5);
   filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#7F2557B1', endColorstr='#7F2557B1');
}

More info about error

Running "cssnext:dist" (cssnext) task
Warning: Unable to parse color from string global Use --force to continue.

Aborted due to warnings.

Would it be possible to have the line and why there is an error?

Error give shitty color (0,0,0)

a { color: color(color(red a(+10%)));}
a { color: color(color(rebeccapurple a(-10%)) a(-10%)); }

give

a { color: rgb(0, 0, 0);}
a { color: rgba(0, 0, 0, 0.9); }

Should make a warning & change nothing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.