This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/postcss-lab-function
cranberry ed23347e56 Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
..
node_modules Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
CHANGELOG.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
LICENSE.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
README.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.cjs.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.cjs.js.map Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.es.mjs Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.es.mjs.map Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

README.md

PostCSS Lab Function PostCSS Logo

NPM Version CSS Standard Status Build Status Support Chat

PostCSS Lab Function lets you use lab, lch, and gray color functions in CSS, following the CSS Color specification.

:root {
  --firebrick: lab(40 56.6 39);
  --firebrick-a50: lch(40 68.8 34.5 / 50%);
  --gray-40: gray(40);
  --gray-40a50: gray(40 / .5);
}

/* becomes */

:root {
  --firebrick: rgb(178, 34, 34);
  --firebrick-a50: rgba(178, 34, 34, .5);
  --gray-40: rgb(94,94,94);
  --gray-40a50: rgba(94,94,94, .5);
}

Usage

Add PostCSS Lab Function to your project:

npm install postcss-lab-function --save-dev

Use PostCSS Lab Function to process your CSS:

const postcssLabFunction = require('postcss-lab-function');

postcssLabFunction.process(YOUR_CSS /*, processOptions, pluginOptions */);

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssLabFunction = require('postcss-lab-function');

postcss([
  postcssLabFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS Lab Function runs in all Node environments, with special instructions for:

Node PostCSS CLI Webpack Create React App Gulp Grunt

Options

preserve

The preserve option determines whether the original functional color notation is preserved. By default, it is not preserved.

postcssLabFunction({ preserve: true })
:root {
  --firebrick: lab(40 56.6 39);
  --firebrick-a50: lch(40 68.8 34.5 / 50%);
}

/* becomes */

:root {
  --firebrick: rgb(178, 34, 34);
  --firebrick: lab(40 56.6 39);
  --firebrick-a50: rgba(178, 34, 34, .5);
  --firebrick-a50: lch(40 68.8 34.5 / 50%);
}