Skip to content

Commit a8bfec6

Browse files
committed
added documentation to _getBrightness() and _getGreen() function
1 parent 3eae276 commit a8bfec6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/color/p5.Color.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,11 @@ class Color {
546546
}
547547
}
548548

549+
/**
550+
* This function extracts the green value from a color object, returns green
551+
* value in the range of 0 to 255 by default. When colorMode() is set to an
552+
* RBG value, the green value within the givin range is returned
553+
*/
549554
_getGreen(max=[0, 1]) {
550555
if(!Array.isArray(max)){
551556
max = [0, max];
@@ -625,6 +630,13 @@ class Color {
625630
return map(to(this._color, 'hsl').coords[1], colorjsMax[0], colorjsMax[1], max[0], max[1]);
626631
}
627632
}
633+
/**
634+
* Brightness obtains the HSB brightness value from either a p5.Color object,
635+
* an array of color components, or a CSS color string.Depending on value,
636+
* when colorMode() is set a HSB value, this function will returns the
637+
* brightness value in the range. By default, this function will return
638+
* the HSB brightness within the range 0 - 100.
639+
*/
628640

629641
_getBrightness(max=[0, 100]) {
630642
if(!Array.isArray(max)){

0 commit comments

Comments
 (0)