Add Color classes for use with AddressableLED (#2127)

Both floating point and 8-bit integer classes are included, as well as a wide selection of color constants.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
Prateek Machiraju
2019-12-30 01:01:20 -05:00
committed by Peter Johnson
parent 96348e835a
commit e874ba9313
7 changed files with 1938 additions and 6 deletions

View File

@@ -12,6 +12,17 @@ public final class MathUtil {
throw new AssertionError("utility class");
}
/**
* Returns value clamped between low and high boundaries.
*
* @param value Value to clamp.
* @param low The lower boundary to which to clamp value.
* @param high The higher boundary to which to clamp value.
*/
public static int clamp(int value, int low, int high) {
return Math.max(low, Math.min(value, high));
}
/**
* Returns value clamped between low and high boundaries.
*