@@ -555,8 +555,9 @@ p5.prototype.clear = function(...args) {
555
555
* @param {Number } [maxA] range for the alpha.
556
556
* @chainable
557
557
*/
558
- p5 . prototype . colorMode = function ( mode , max1 , max2 , max3 , maxA ) {
559
- p5 . _validateParameters ( 'colorMode' , arguments ) ;
558
+ p5 . prototype . colorMode = function ( ...args ) {
559
+ const [ mode , max1 , max2 , max3 , maxA ] = args ;
560
+ p5 . _validateParameters ( 'colorMode' , args ) ;
560
561
if (
561
562
mode === constants . RGB ||
562
563
mode === constants . HSB ||
@@ -567,16 +568,16 @@ p5.prototype.colorMode = function(mode, max1, max2, max3, maxA) {
567
568
568
569
// Set color maxes.
569
570
const maxes = this . _colorMaxes [ mode ] ;
570
- if ( arguments . length === 2 ) {
571
+ if ( args . length === 2 ) {
571
572
maxes [ 0 ] = max1 ; // Red
572
573
maxes [ 1 ] = max1 ; // Green
573
574
maxes [ 2 ] = max1 ; // Blue
574
575
maxes [ 3 ] = max1 ; // Alpha
575
- } else if ( arguments . length === 4 ) {
576
+ } else if ( args . length === 4 ) {
576
577
maxes [ 0 ] = max1 ; // Red
577
578
maxes [ 1 ] = max2 ; // Green
578
579
maxes [ 2 ] = max3 ; // Blue
579
- } else if ( arguments . length === 5 ) {
580
+ } else if ( args . length === 5 ) {
580
581
maxes [ 0 ] = max1 ; // Red
581
582
maxes [ 1 ] = max2 ; // Green
582
583
maxes [ 2 ] = max3 ; // Blue
0 commit comments