/postcss-color-invert

:last_quarter_moon: A PostCSS plugin to invert colors

Primary LanguageJavaScriptMIT LicenseMIT

postcss-color-invert npm Version Build Status Coverage Status

A PostCSS plugin to invert colors

  • Supports inverting colors specified in hex, RGB, RGBA, HSL, and HSLA formats

Usage

const fs = require('fs')
const path = require('path')
const postcss = require('postcss')
const postcssColorInvert = require('postcss-color-invert')

const inputFile = path.join(__dirname, 'input.css')
const input = fs.readFileSync(inputFile, 'utf8')
console.log(input) // => 'a { color: #ff0000; }'

postcss([postcssColorInvert()])
  .process(input, { from: inputFile })
  .then(function (result) {
    console.log(result.css) // => 'a { color: #00ffff; }'
  })

Installation

$ yarn add --dev postcss-color-invert

License

MIT