pyface
pyface copied to clipboard
Add an immutable color type
Currently there is an issue with the use of the new Color objects in that they are heavy-weight traits objects designed for backing a colour editor or other situation where the individual components might be being manipulated.
However in many cases the use-case for colors is ephemeral, or the colors are unlikely to change in a fine-grained way. For these cases the overhead of setting up all the traits infrastructure is excessive. An immutable class that shares much of its API with the current Color class may be useful: in particular if it shares the same methods for conversion to/from toolkit colors and, ideally, is compatible with Enable's expectation of colors.
It may make sense to encode the common API in a formal interface.
In terms of implementation, I am thinking of something like a namedtuple with additional methods.