8000 add clamping to hsl and hsla functions · nullstring/less.js@ac3a92d · GitHub
[go: up one dir, main page]

Skip to content

Commit ac3a92d

Browse files
committed
add clamping to hsl and hsla functions
1 parent b200459 commit ac3a92d

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

lib/less/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tree.functions = {
1414
},
1515
hsla: function (h, s, l, a) {
1616
h = (number(h) % 360) / 360;
17-
s = number(s); l = number(l); a = number(a);
17+
s = clamp(number(s)); l = clamp(number(l)); a = clamp(number(a));
1818

1919
var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
2020
var m1 = l * 2 - m2;

test/css/functions.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line number AD79 Diff line change
@@ -13,6 +13,7 @@
1313
saturate: #203c31;
1414
desaturate: #29332f;
1515
greyscale: #2e2e2e;
16+
hsl-clamp: #ffffff;
1617
spin-p: #bf6a40;
1718
spin-n: #bf4055;
1819
luma-white: 100%;

test/less/functions.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
saturate: saturate(#29332f, 20%);
1818
desaturate: desaturate(#203c31, 20%);
1919
greyscale: greyscale(#203c31);
20+
hsl-clamp: hsl(380, 150%, 150%);
2021
spin-p: spin(hsl(340, 50%, 50%), 40);
2122
spin-n: spin(hsl(30, 50%, 50%), -40);
2223
luma-white: luma(#fff);

0 commit comments

Comments
 (0)
0