Skip to content

Commit b67dbeb

Browse files
committed
Update README.md
ref postcss#1
1 parent c9994cf commit b67dbeb

File tree

1 file changed

+56
-8
lines changed

1 file changed

+56
-8
lines changed

README.md

+56-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# postcss-color-function [![Build Status](https://travis-ci.org/postcss/postcss-color-function.png)](https://travis-ci.org/postcss/postcss-color-function)
1+
# postcss-color-function [![Build Status](https://travis-ci.org/postcss/postcss-color-function.svg)](https://travis-ci.org/postcss/postcss-color-function)
22

3-
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS color function](http://dev.w3.org/csswg/css-color/#modifying-colors) to more compatible CSS.
3+
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS color function][specs] to more compatible CSS.
44
55
## Installation
66

7-
```bash
7+
```console
88
$ npm install postcss-color-function
99
```
1010

@@ -43,19 +43,67 @@ body {
4343
}
4444
```
4545

46-
Checkout [tests](test) for more examples.
46+
Checkout [tests](test) for examples.
47+
48+
## Interface (according to CSS specs)
49+
50+
```
51+
color( [ <color> | <hue> ] <color-adjuster>* )
52+
```
53+
54+
### List of `color-adjuster`
55+
56+
- `[red( | green( | blue( | alpha( | a(] ['+' | '-']? [<number> | <percentage>] )`
57+
- `[red( | green( | blue( | alpha( | a(] '*' <percentage> )`
58+
- ~~`rgb( ['+' | '-'] [<number> | <percentage>]{3} )`~~ @todo
59+
- ~~`rgb( ['+' | '-'] <hash-token> )`~~ @todo
60+
- ~~`rgb( '*' <percentage> ) |`~~ @todo
61+
- `[hue( | h(] ['+' | '-' | '*']? <angle> )`
62+
- `[saturation( | s(] ['+' | '-' | '*']? <percentage> )`
63+
- `[lightness( | l(] ['+' | '-' | '*']? <percentage> )`
64+
- `[whiteness( | w(] ['+' | '-' | '*']? <percentage> )`
65+
- `[blackness( | b(] ['+' | '-' | '*']? <percentage> )`
66+
- `tint( <percentage> )`
67+
- `shade( <percentage> )`
68+
- `blend( <color> <percentage> [rgb | hsl | hwb]? )`
69+
- ~~`blenda( <color> <percentage> [rgb | hsl | hwb]? )`~~ @todo
70+
- ~~`contrast( <percentage>? )`~~ @todo
71+
72+
Notes:
73+
74+
- some adjusts have shortcuts,
75+
- can be used on every value on any property,
76+
- some values can use add/subtract/scale modifiers or a direct value.
77+
78+
[Read the specs][specs] for more information.
79+
80+
### Examples
81+
82+
```css
83+
whatever {
84+
color: color(red a(10%);
85+
86+
background-color: color(red lightness(50%)); /* == color(red l(50%)); */
87+
88+
border-color: color(hsla(125, 50%, 50%, .4) saturation(+ 10%) w(- 20%));
89+
}
90+
```
4791

4892
---
4993

5094
## Contributing
5195

5296
Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.
5397

54-
$ git clone https://github.com/postcss/postcss-color-function.git
55-
$ git checkout -b patch-1
56-
$ npm install
57-
$ npm test
98+
```console
99+
$ git clone https://github.com/postcss/postcss-color-function.git
100+
$ git checkout -b patch-1
101+
$ npm install
102+
$ npm test
103+
```
58104

59105
## [Changelog](CHANGELOG.md)
60106

61107
## [License](LICENSE)
108+
109+
[specs]: (http://dev.w3.org/csswg/css-color/#modifying-colors)

0 commit comments

Comments
 (0)