Hi John,
[ moving this to pyx-devel, where it's more appropriate ]
On 18.06.06, John Owens wrote:
> Joerg Lehmann <joergl <at> users.sourceforge.net> writes:
>
> > I'd would like to suggest to use
> >
> > - color.gradient for the continuous version and
> > - color.palette for the discrete version
>
> If we did this - and I've got no problem with it - what should
> the parent class be named? Right now it's palette with
> linearpalette as a subclass (and also functionpalette).
> The interface will be the same for any of those (gradient,
> palette, functionpalette), so it would make sense to rename
> the current 'palette' to something else. color.colormap?
> color.multiple? color.map?
I'm not sure we need a common parent class for gradient and palette.
Btw, I'm about to rename palette->gradient in the PyX trunk.
The new palette will look like
class palette(attr.changeattr):
"""color palettes
A color palette comprises multiple discrete, ordered collections of
colors"""
def __init__(self, colorlists):
""" initialize the color palette with colorlists
colorlists is a list of list of colors, with len(colorlists[i]) = i+1"""
self.colorlists = colorlists
def select(self, index, total):
return self.colorlists[total-1][index]
The initialization then goes as
palette.greys = palette([[grey.black],
[grey.white, grey.black],
[grey.white, grey.grey(0.5), grey.black]])
One question would be, whether we provide a fallback handling in
palette.select of the case with total > len(colorlists).
Jörg
_______________________________________________
PyX-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-devel