enthought/chaco — pull request #177 by kjordahl (2014-02-03 03:35:09+00:00)
Title: Allow bgcolor to be set to any color, not just string

Setting the `bgcolor` trait of a `Plot` instance (or an instance of its parent `DataView` class) only works if the argument is a string. This change allows it to take any color value. This also adds a `colors_equal()` function to `chaco.api` to allow comparison of colors that may be in different formats.

Without this change, the following will fail, raising `KeyError`:

from chaco.api import Plot
plot = Plot(bgcolor=(1, 1, 1))

Tests that cover the new function and the `bgcolor` bug are included.

In general, colors should be settable to any `ColorTrait` allowed value, not just strings. There are a few more comparisons in the codebase that could be cleaned up to allow more general color definitions as well.