2.0.10 • Published 10 months ago

@csstools/postcss-contrast-color-function v2.0.10

Weekly downloads
-
License
MIT-0
Repository
github
Last release
10 months ago

PostCSS Contrast Color Function

npm install @csstools/postcss-contrast-color-function --save-dev

PostCSS Contrast Color Function lets you dynamically specify a text color with adequate contrast following the CSS Color 5 Specification.

.color {
	color: contrast-color(oklch(82% 0.2 330));
}

/* becomes */

.color {
	color: rgb(0, 0, 0);
	color: contrast-color(oklch(82% 0.2 330));
}

Usage

Add PostCSS Contrast Color Function to your project:

npm install postcss @csstools/postcss-contrast-color-function --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssContrastColorFunction = require('@csstools/postcss-contrast-color-function');

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

Options

preserve

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

postcssContrastColorFunction({ preserve: false })
.color {
	color: contrast-color(oklch(82% 0.2 330));
}

/* becomes */

.color {
	color: rgb(0, 0, 0);
}
2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

11 months ago

2.0.10

10 months ago

2.0.8

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

2.0.1

2 years ago

1.0.4

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago