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

Commit 1f3ce3b

Browse files
committed
1.0.1
1 parent a2b9cd2 commit 1f3ce3b

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to PostCSS Lab Function
22

3+
### 1.0.1 (May 11, 2018)
4+
5+
- Fixed: Values beyond the acceptable 0-255 RGB range
6+
37
### 1.0.0 (May 11, 2018)
48

59
- Initial version

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default postcss.plugin('postcss-lab-function', opts => {
5454
number => parseFloat(number)
5555
)
5656
).map(
57-
sourceValue => parseInt(sourceValue * 2.55)
57+
sourceValue => Math.max(Math.min(parseInt(sourceValue * 2.55), 255), 0)
5858
)
5959

6060
children[0].value = String(rgbValues[0]);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-lab-function",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Use lab() and lch() color functions in CSS",
55
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
66
"license": "CC0-1.0",

test/basic.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
color: lab(40 56.6 39 / .5);
55
color: lab(40 56.6 39 / 100%);
66
color: lab(40 56.6 39 / 50%);
7+
color: lab(100 50 0);
78
}
89

910
.test-lch {
@@ -12,4 +13,5 @@
1213
color: lch(40 68.8 34.5 / .5);
1314
color: lch(40 68.8 34.5 / 100%);
1415
color: lch(40 68.8 34.5 / 50%);
16+
color: lch(100 50 0);
1517
}

test/basic.expect.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
color: rgba(178, 34, 34, .5);
55
color: rgb(178, 34, 34);
66
color: rgba(178, 34, 34, 0.5);
7+
color: rgb(255, 216, 255);
78
}
89

910
.test-lch {
@@ -12,4 +13,5 @@
1213
color: rgba(178, 34, 34, .5);
1314
color: rgb(178, 34, 34);
1415
color: rgba(178, 34, 34, 0.5);
16+
color: rgb(255, 216, 255);
1517
}

test/basic.preserve-true.expect.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
color: lab(40 56.6 39 / 100%);
1010
color: rgba(178, 34, 34, 0.5);
1111
color: lab(40 56.6 39 / 50%);
12+
color: rgb(255, 216, 255);
13+
color: lab(100 50 0);
1214
}
1315

1416
.test-lch {
@@ -22,4 +24,6 @@
2224
color: lch(40 68.8 34.5 / 100%);
2325
color: rgba(178, 34, 34, 0.5);
2426
color: lch(40 68.8 34.5 / 50%);
27+
color: rgb(255, 216, 255);
28+
color: lch(100 50 0);
2529
}

0 commit comments

Comments
 (0)