X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FColor.java;h=dd3b93de18c72dd2005e1a5bd01e45f02aca7f77;hb=4328bb42c10743287dad5cf045f059ad109eb540;hp=88cc5843cd07163b8f37a93213f26641f4d47bc4;hpb=05dbb28d6e8613216f43e8d0fae487c1d9c2fcd3;p=nikiroo-utils.git diff --git a/src/jexer/bits/Color.java b/src/jexer/bits/Color.java index 88cc584..dd3b93d 100644 --- a/src/jexer/bits/Color.java +++ b/src/jexer/bits/Color.java @@ -101,12 +101,10 @@ public class Color { /** * Invert a color in the same way as (CGA/VGA color XOR 0x7). - * - * @param color color to change * @return the inverted color */ - static public Color invert(Color color) { - switch (color.value) { + public Color invert() { + switch (value) { case black: return Color.WHITE; case white: @@ -125,6 +123,19 @@ public class Color { return Color.BLUE; } throw new IllegalArgumentException("Invalid Color value: " + - color.value); + value); + } + + /** + * Comparison. All fields must match to return true. + */ + @Override + public boolean equals(Object rhs) { + if (!(rhs instanceof Color)) { + return false; + } + + Color that = (Color)rhs; + return (value == that.value); } }