Skip to content

Commit a9c5076

Browse files
committed
Color: Fixed hls(a) parsing. See mrdoob#7336.
1 parent 9f5f6ba commit a9c5076

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/math/Color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ THREE.Color.prototype = {
191191
if ( color = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec( components ) ) {
192192

193193
// hsl(120,50%,50%)
194-
var h = parseFloat( color[ 1 ] );
194+
var h = parseFloat( color[ 1 ] ) / 360;
195195
var s = parseInt( color[ 2 ], 10 ) / 100;
196196
var l = parseInt( color[ 3 ], 10 ) / 100;
197197

@@ -206,7 +206,7 @@ THREE.Color.prototype = {
206206
if ( color = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec( components ) ) {
207207

208208
// hsla(120,50%,50%,0.5)
209-
var h = parseFloat( color[ 1 ] );
209+
var h = parseFloat( color[ 1 ] ) / 360;
210210
var s = parseInt( color[ 2 ], 10 ) / 100;
211211
var l = parseInt( color[ 3 ], 10 ) / 100;
212212
parseAlpha( color[ 4 ] );

0 commit comments

Comments
 (0)