pyface icon indicating copy to clipboard operation
pyface copied to clipboard

Add an immutable color type

Open corranwebster opened this issue 3 years ago • 1 comments

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.

corranwebster avatar Apr 23 '21 10:04 corranwebster

In terms of implementation, I am thinking of something like a namedtuple with additional methods.

corranwebster avatar Apr 23 '21 10:04 corranwebster