No way to store arbitrary colors
Created by: gyscos
Hi,
I cannot find a way to store an arbitrary color in a struct and use it in a Fg
or Bg
. Possible solutions:
- Have an
enum
implementingColor
with a variant for each color type. - Store a
Box<Color>
as a trait object. The easiest way for that is probably to haveimpl <C: Color> Color for Box<C>
.
The first option is more efficient (no heap allocation required), while the second option is more extensible if users define their own types implementing Color
. These two options are also not incompatible.