mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilibj] Add toString() methods to Color and Color8Bit (#4286)
This commit is contained in:
committed by
GitHub
parent
fc37265da5
commit
45b598d236
@@ -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);
|
||||
|
||||
@@ -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 + '}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user