[wpilibj] Add toString() methods to Color and Color8Bit (#4286)

This commit is contained in:
Prateek Machiraju
2022-06-02 21:23:11 -07:00
committed by GitHub
parent fc37265da5
commit 45b598d236
2 changed files with 10 additions and 0 deletions

View File

@@ -99,6 +99,11 @@ public class Color {
return Objects.hash(red, green, blue);
}
@Override
public String toString() {
return "Color{" + "red=" + red + ", green=" + green + ", blue=" + blue + '}';
}
private static double roundAndClamp(double value) {
final var rounded = Math.round((value + kPrecision / 2) / kPrecision) * kPrecision;
return MathUtil.clamp(rounded, 0.0, 1.0);

View File

@@ -53,4 +53,9 @@ public class Color8Bit {
public int hashCode() {
return Objects.hash(red, green, blue);
}
@Override
public String toString() {
return "Color8Bit{" + "red=" + red + ", green=" + green + ", blue=" + blue + '}';
}
}