@@ -1043,8 +1043,25 @@ function creatingReading(p5, fn){
10431043 * </div>
10441044 */
10451045 fn . hue = function ( c ) {
1046- // p5._validateParameters('hue', arguments);
1047- return this . color ( c ) . _getHue ( ) ;
1046+ let colorMode = HSL ;
1047+ let i = 0 ;
1048+
1049+ if (
1050+ this . _renderer . states . colorMode === HSB ||
1051+ this . _renderer . states . colorMode === HSL
1052+ ) {
1053+ colorMode = this . _renderer . states . colorMode ;
1054+ } else if (
1055+ this . _renderer . states . colorMode === LCH ||
1056+ this . _renderer . states . colorMode === OKLCH
1057+ ) {
1058+ colorMode = this . _renderer . states . colorMode ;
1059+ i = 2 ;
1060+ }
1061+
1062+ return this . color ( c ) . _getHue (
1063+ this . _renderer . states . colorMaxes [ colorMode ] [ i ]
1064+ ) ;
10481065 } ;
10491066
10501067 /**
@@ -1220,8 +1237,16 @@ function creatingReading(p5, fn){
12201237 * </div>
12211238 */
12221239 fn . saturation = function ( c ) {
1223- // p5._validateParameters('saturation', arguments);
1224- return this . color ( c ) . _getSaturation ( ) ;
1240+ const colorMode = (
1241+ this . _renderer . states . colorMode === HSB ||
1242+ this . _renderer . states . colorMode === HSL
1243+ ) ?
1244+ this . _renderer . states . colorMode :
1245+ HSL ;
1246+
1247+ return this . color ( c ) . _getSaturation (
1248+ this . _renderer . states . colorMaxes [ colorMode ] [ 1 ]
1249+ ) ;
12251250 } ;
12261251
12271252 /**
@@ -1365,8 +1390,9 @@ function creatingReading(p5, fn){
13651390 * </div>
13661391 */
13671392 fn . brightness = function ( c ) {
1368- // p5._validateParameters('brightness', arguments);
1369- return this . color ( c ) . _getBrightness ( ) ;
1393+ return this . color ( c ) . _getBrightness (
1394+ this . _renderer . states . colorMaxes . hsb [ 2 ]
1395+ ) ;
13701396 } ;
13711397
13721398 /**
@@ -1510,8 +1536,9 @@ function creatingReading(p5, fn){
15101536 * </div>
15111537 */
15121538 fn . lightness = function ( c ) {
1513- // p5._validateParameters('lightness', arguments);
1514- return this . color ( c ) . _getLightness ( ) ;
1539+ return this . color ( c ) . _getLightness (
1540+ this . _renderer . states . colorMaxes . hsl [ 2 ]
1541+ ) ;
15151542 } ;
15161543
15171544 /**
0 commit comments