Using the Java Color class for specifying colors can be too tedious for testing purposes. When writing a test that checks that a given table cell is red, we do not always want to specify the exact color (#FF0000 in RGB), we just want to say "red" and have our test run even if the color chosen by the developers is #DD1111.

To this end, UISpec4J proposes three different means for checking a color:

This is why all color-related methods such as Table.backgroundEquals use Object arguments - you can provide them either String or Color objects.

Behind the scenes, UISpec4J basically computes a distance between expected and actual colors by converting them in the HSB (Hue/Saturation/Brightness) color space. Results may not always be accurate since colors can be subject to one's judgement, but in such cases you can always stick to more formal definitions - although as a result your tests will be more sensible to little cosmetic changes.