From c06f7ee0a40255214c477e13d9b956a7e07c2900 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 14 Oct 2023 15:05:55 +0800 Subject: postcss,(plugins): nanocss, postcss-preset-env --- .../@csstools/postcss-gamut-mapping/README.md | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 node_modules/@csstools/postcss-gamut-mapping/README.md (limited to 'node_modules/@csstools/postcss-gamut-mapping/README.md') diff --git a/node_modules/@csstools/postcss-gamut-mapping/README.md b/node_modules/@csstools/postcss-gamut-mapping/README.md new file mode 100644 index 00000000..a5edb31c --- /dev/null +++ b/node_modules/@csstools/postcss-gamut-mapping/README.md @@ -0,0 +1,84 @@ +# PostCSS Gamut Mapping [PostCSS Logo][PostCSS] + +[npm version][npm-url] [CSS Standard Status][css-url] [Build Status][cli-url] [Discord][discord] + +```bash +npm install @csstools/postcss-gamut-mapping --save-dev +``` + +[PostCSS Gamut Mapping] lets you use wide gamut colors with gamut mapping for specific displays following the [CSS Color 4 Specification]. + +When out of gamut colors are naively clipped the result can be radically different. +A saturated and bright color will be much darker after clipping. + +To correctly adjust colors for a narrow gamut display, the colors must be mapped. +This is done by lowering the `chroma` in `oklch` until the color is in gamut. + +Using the `@media (color-gamut)` media feature makes it possible to only use the wide gamut colors on displays that support them. + +```pcss +p { + background-color: oklch(80% 0.05 0.39 / 0.5); + color: oklch(20% 0.234 0.39 / 0.5); + border-color: color(display-p3 0 1 0); +} + +/* becomes */ + +p { + background-color: oklch(80% 0.05 0.39 / 0.5); + color: rgba(50, 0, 20, 0.5); + border-color: rgb(0, 249, 66); +} + +@media (color-gamut: rec2020) { +p { + color: oklch(20% 0.234 0.39 / 0.5); +} +} + +@media (color-gamut: p3) { +p { + border-color: color(display-p3 0 1 0); +} +} +``` + +## Usage + +Add [PostCSS Gamut Mapping] to your project: + +```bash +npm install postcss @csstools/postcss-gamut-mapping --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssGamutMapping = require('@csstools/postcss-gamut-mapping'); + +postcss([ + postcssGamutMapping(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Gamut Mapping] runs in all Node environments, with special +instructions for: + +- [Node](INSTALL.md#node) +- [PostCSS CLI](INSTALL.md#postcss-cli) +- [PostCSS Load Config](INSTALL.md#postcss-load-config) +- [Webpack](INSTALL.md#webpack) +- [Next.js](INSTALL.md#nextjs) +- [Gulp](INSTALL.md#gulp) +- [Grunt](INSTALL.md#grunt) + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#gamut-mapping +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/postcss-gamut-mapping + +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Gamut Mapping]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gamut-mapping +[CSS Color 4 Specification]: https://www.w3.org/TR/css-color-4/#gamut-mapping -- cgit v1.2.3