@@ -168,10 +168,10 @@ var named = {
168
168
} ;
169
169
170
170
define ( Color , color , {
171
- copy : function ( channels ) {
171
+ copy ( channels ) {
172
172
return Object . assign ( new this . constructor , this , channels ) ;
173
173
} ,
174
- displayable : function ( ) {
174
+ displayable ( ) {
175
175
return this . rgb ( ) . displayable ( ) ;
176
176
} ,
177
177
hex : color_formatHex , // Deprecated! Use color.formatHex.
@@ -245,21 +245,21 @@ export function Rgb(r, g, b, opacity) {
245
245
}
246
246
247
247
define ( Rgb , rgb , extend ( Color , {
248
- brighter : function ( k ) {
248
+ brighter ( k ) {
249
249
k = k == null ? brighter : Math . pow ( brighter , k ) ;
250
250
return new Rgb ( this . r * k , this . g * k , this . b * k , this . opacity ) ;
251
251
} ,
252
- darker : function ( k ) {
252
+ darker ( k ) {
253
253
k = k == null ? darker : Math . pow ( darker , k ) ;
254
254
return new Rgb ( this . r * k , this . g * k , this . b * k , this . opacity ) ;
255
255
} ,
256
- rgb : function ( ) {
256
+ rgb ( ) {
257
257
return this ;
258
258
} ,
259
- clamp : function ( ) {
259
+ clamp ( ) {
260
260
return new Rgb ( clampi ( this . r ) , clampi ( this . g ) , clampi ( this . b ) , clampa ( this . opacity ) ) ;
261
261
} ,
262
- displayable : function ( ) {
262
+ displayable ( ) {
263
263
return ( - 0.5 <= this . r && this . r < 255.5 )
264
264
&& ( - 0.5 <= this . g && this . g < 255.5 )
265
265
&& ( - 0.5 <= this . b && this . b < 255.5 )
@@ -343,15 +343,15 @@ function Hsl(h, s, l, opacity) {
343
343
}
344
344
345
345
define ( Hsl , hsl , extend ( Color , {
346
- brighter : function ( k ) {
346
+ brighter ( k ) {
347
347
k = k == null ? brighter : Math . pow ( brighter , k ) ;
348
348
return new Hsl ( this . h , this . s , this . l * k , this . opacity ) ;
349
349
} ,
350
- darker : function ( k ) {
350
+ darker ( k ) {
351
351
k = k == null ? darker : Math . pow ( darker , k ) ;
352
352
return new Hsl ( this . h , this . s , this . l * k , this . opacity ) ;
353
353
} ,
354
- rgb : function ( ) {
354
+ rgb ( ) {
355
355
var h = this . h % 360 + ( this . h < 0 ) * 360 ,
356
356
s = isNaN ( h ) || isNaN ( this . s ) ? 0 : this . s ,
357
357
l = this . l ,
@@ -364,15 +364,15 @@ define(Hsl, hsl, extend(Color, {
364
364
this . opacity
365
365
) ;
366
366
} ,
367
- clamp : function ( ) {
367
+ clamp ( ) {
368
368
return new Hsl ( clamph ( this . h ) , clampt ( this . s ) , clampt ( this . l ) , clampa ( this . opacity ) ) ;
369
369
} ,
370
- displayable : function ( ) {
370
+ displayable ( ) {
371
371
return ( 0 <= this . s && this . s <= 1 || isNaN ( this . s ) )
372
372
&& ( 0 <= this . l && this . l <= 1 )
373
373
&& ( 0 <= this . opacity && this . opacity <= 1 ) ;
374
374
} ,
375
- formatHsl : function ( ) {
375
+ formatHsl ( ) {
376
376
const a = clampa ( this . opacity ) ;
377
377
return `${ a === 1 ? "hsl(" : "hsla(" } ${ clamph ( this . h ) } , ${ clampt ( this . s ) * 100 } %, ${ clampt ( this . l ) * 100 } %${ a === 1 ? ")" : `, ${ a } )` } ` ;
378
378
}
0 commit comments