source: frontend/node_modules/@csstools/postcss-hwb-function/README.md@ cdcff72

Last change on this file since cdcff72 was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.6 KB
Line 
1# PostCSS HWB Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
2
3[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-hwb-function.svg" height="20">][npm-url]
4[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/hwb-function.svg" height="20">][css-url]
5[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
6[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
7
8
9[PostCSS HWB Function] lets you use `hwb` color functions in
10CSS, following the [CSS Color] specification.
11
12```pcss
13a {
14 color: hwb(194 0% 0%);
15 color: hwb(194 0% 0% / .5);
16}
17
18/* becomes */
19
20a {
21 color: rgb(0, 195, 255);
22 color: rgba(0, 195, 255, .5);
23}
24```
25
26## Usage
27
28Add [PostCSS HWB Function] to your project:
29
30```bash
31npm install postcss @csstools/postcss-hwb-function --save-dev
32```
33
34Use it as a [PostCSS] plugin:
35
36```js
37const postcss = require('postcss');
38const postcssHWBFunction = require('@csstools/postcss-hwb-function');
39
40postcss([
41 postcssHWBFunction(/* pluginOptions */)
42]).process(YOUR_CSS /*, processOptions */);
43```
44
45[PostCSS HWB Function] runs in all Node environments, with special
46instructions for:
47
48| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
49| --- | --- | --- | --- | --- | --- |
50
51## Options
52
53### preserve
54
55The `preserve` option determines whether the original functional color notation
56is preserved. By default, it is not preserved.
57
58```js
59postcssHWBFunction({ preserve: true })
60```
61
62```pcss
63a {
64 color: hwb(194 0% 0%);
65 color: hwb(194 0% 0% / .5);
66}
67
68/* becomes */
69
70a {
71 color: rgb(0, 195, 255);
72 color: hwb(194 0% 0%);
73 color: rgba(0, 195, 255, .5);
74 color: hwb(194 0% 0% / .5);
75}
76```
77
78[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
79[css-url]: https://cssdb.org/#hwb-function
80[discord]: https://discord.gg/bUadyRwkJS
81[npm-url]: https://www.npmjs.com/package/@csstools/postcss-hwb-function
82
83[CSS Color]: https://drafts.csswg.org/css-color/#the-hwb-notation
84[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
85[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
86[PostCSS]: https://github.com/postcss/postcss
87[PostCSS Loader]: https://github.com/postcss/postcss-loader
88[PostCSS HWB Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function
Note: See TracBrowser for help on using the repository browser.