@@ -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,10 @@ 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 = ( this . _renderer . states . colorMode === HSB ) ? HSB : HSL ;
1241+ return this . color ( c ) . _getSaturation (
1242+ this . _renderer . states . colorMaxes [ colorMode ] [ 1 ]
1243+ ) ;
12251244 } ;
12261245
12271246 /**
@@ -1365,8 +1384,9 @@ function creatingReading(p5, fn){
13651384 * </div>
13661385 */
13671386 fn . brightness = function ( c ) {
1368- // p5._validateParameters('brightness', arguments);
1369- return this . color ( c ) . _getBrightness ( ) ;
1387+ return this . color ( c ) . _getBrightness (
1388+ this . _renderer . states . colorMaxes . hsb [ 2 ]
1389+ ) ;
13701390 } ;
13711391
13721392 /**
@@ -1510,8 +1530,9 @@ function creatingReading(p5, fn){
15101530 * </div>
15111531 */
15121532 fn . lightness = function ( c ) {
1513- // p5._validateParameters('lightness', arguments);
1514- return this . color ( c ) . _getLightness ( ) ;
1533+ return this . color ( c ) . _getLightness (
1534+ this . _renderer . states . colorMaxes . hsl [ 2 ]
1535+ ) ;
15151536 } ;
15161537
15171538 /**
0 commit comments