Skip to content

Commit 9515a62

Browse files
authored
Merge pull request #7908 from FerrinThreatt/dev-2.0
added documentation to _getBrightness() and _getGreen() function
2 parents 5579bb8 + 655667d commit 9515a62

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 and
551+
* returns it in the range 0–255 by default. When `colorMode()` is given 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 to HSB, this function will return 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)