-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plot/palette: clean up API #352
Comments
Makes sense to me. On this topic, additionally, I'm somewhat confused regarding what the purpose of the palette.Palette interface is. It only has one method, and the method doesn't take any arguments, so anything that is being used as a palette has to know ahead of time what colors it is going to return. Given that, would it make more sense to do |
I suppose one reason is that without a Palette interface we couldn't have a DivergingPalette. That may be enough to justify it, but it still feels to me like a lot of complexity just for that. |
palette.Palette is justified by the same argument as fmt.Stringer. |
The functions in fmt are set up so they can take either a string or a fmt.Stringer (or anything else). So the existence of fmt.Stringer doesn't prevent people from using plain strings in the functions. In this case, though, we have to choose between accepting []color.Color or palette.Palette; there doesn't seem to be a good way to accept both. I agree, though, that on balance palette.Palette is probably the better choice. |
I am troubled by the size of the
ColorMap
interface. It can be reduced in size toand
The
Set
methods are required because the concrete types are not exported. This can be fixed with minor name juggling on the field names of the concrete types. For example:The text was updated successfully, but these errors were encountered: