Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit a1a2bbe

Browse files
committed
explode color feature
Close #40
1 parent fa8ea7b commit a1a2bbe

11 files changed

+45
-11
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ _Follow [@cssnext](https://twitter.com/cssnext) to get latest news & [join #cssn
3535
* [custom properties & `var()`](http://www.w3.org/TR/css-variables/) (via [postcss-custom-properties](https://github.com/postcss/postcss-custom-properties))
3636
* [reduced `calc()`](https://github.com/MoOx/reduce-css-calc#readme) (via [postcss-calc](https://github.com/postcss/postcss-calc), to optimize previously parsed `var()` references)
3737
* [custom media queries](http://dev.w3.org/csswg/mediaqueries/#custom-mq) (via [postcss-custom-media](https://github.com/postcss/postcss-custom-media)), a nice way to avoid repeating media queries
38-
* [`color()`](http://dev.w3.org/csswg/css-color/#modifying-colors) (via [postcss-color](https://github.com/postcss/postcss-color)), a color function to modify color
39-
* [`hwb()`](http://dev.w3.org/csswg/css-color/#the-hwb-notation) (via [postcss-color](https://github.com/postcss/postcss-color)), similar to `hsl()` but easier for humans to work with
40-
* [#rrggbbaa](http://dev.w3.org/csswg/css-color/#hex-notation) (via [postcss-color](https://github.com/postcss/postcss-color))
38+
* [`color()`](http://dev.w3.org/csswg/css-color/#modifying-colors) (via [postcss-color-function](https://github.com/postcss/postcss-color-function)), a color function to modify color
39+
* [`hwb()`](http://dev.w3.org/csswg/css-color/#the-hwb-notation) (via [postcss-color-hwb](https://github.com/postcss/postcss-color-hwb)), similar to `hsl()` but easier for humans to work with
40+
* [#rrggbbaa](http://dev.w3.org/csswg/css-color/#hex-notation) (via [postcss-color-hex-alpha](https://github.com/postcss/postcss-color-hex-alpha))
41+
* [`rebeccapurple`](http://dev.w3.org/csswg/css-color/#valdef-color-rebeccapurple) (via [postcss-color-rebeccapurple](https://github.com/postcss/postcss-color-rebeccapurple))
4142

4243

4344
### Additionals enhancements
@@ -131,7 +132,10 @@ Here are all available features:
131132
- `customProperties`
132133
- `calc`
133134
- `customMedia`
134-
- `color`
135+
- `color-function`
136+
- `color-hex-alpha`
137+
- `color-hwb`
138+
- `color-rebeccapurple`
135139
- `prefixes`
136140

137141
##### `browsers` (default: autoprefixer default)

index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
var Postcss = require("postcss")
55

66
var features = {
7-
import: function(options) { return require("postcss-import")(options) },
8-
customProperties: function(options) { return require("postcss-custom-properties")(options) },
9-
calc: function(options) { return require("postcss-calc")(options)},
10-
customMedia: function(options) { return require("postcss-custom-media")(options)},
11-
color: function(options) { return require("postcss-color")(options)},
12-
prefixes: function(options) { return require("autoprefixer-core")(options).postcss}
7+
import: function(options) { return require("postcss-import")(options) },
8+
customProperties: function(options) { return require("postcss-custom-properties")(options) },
9+
calc: function(options) { return require("postcss-calc")(options)},
10+
customMedia: function(options) { return require("postcss-custom-media")(options)},
11+
colorRebeccapurple: function(options) { return require("postcss-color-rebeccapurple")(options)},
12+
colorHwb: function(options) { return require("postcss-color-hwb")(options)},
13+
colorHexAlpha: function(options) { return require("postcss-color-hex-alpha")(options)},
14+
colorFunction: function(options) { return require("postcss-color-function")(options)},
15+
prefixes: function(options) { return require("autoprefixer-core")(options).postcss}
1316
}
1417

1518
/**

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"node-watch": "^0.3.4",
3636
"postcss": "^2.2.1",
3737
"postcss-calc": "^2.0.1",
38-
"postcss-color": "^1.0.0",
38+
"postcss-color-function": "^1.0.0",
39+
"postcss-color-hex-alpha": "^1.0.0",
40+
"postcss-color-hwb": "^1.0.0",
41+
"postcss-color-rebeccapurple": "^1.0.0",
3942
"postcss-custom-media": "^1.0.0",
4043
"postcss-custom-properties": "^0.3.1",
4144
"postcss-import": "^1.0.1",

test/features/color-function.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: color(rgb(102, 51, 153) a(90%))
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: rgba(102, 51, 153, 0.9)
3+
}

test/features/color-hex-alpha.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: #9d9c
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: rgba(153, 221, 153, 0.8)
3+
}

test/features/color-hwb.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: hwb(0, 20%, 40%)
3+
}

test/features/color-hwb.expected.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: rgb(153, 51, 51)
3+
}

test/features/color-rebeccapurple.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: rebeccapurple
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: rgb(102, 51, 153)
3+
}

0 commit comments

Comments
 (0)