code.pyret.org icon indicating copy to clipboard operation
code.pyret.org copied to clipboard

Expose the color-generator from error messages

Open schanzer opened this issue 3 years ago • 6 comments
trafficstars

We'd like to be able to get a stream of colors (as many as we need!), for use in the chart library via .colors(..).

(related to #412)

schanzer avatar Feb 10 '22 17:02 schanzer

Aesthetically I don't think you quite want to use those, because honestly a bunch of the colors tend towards the olive-greeny-orange chunk of the color wheel... Also, even though pairwise any two consecutively generated colors have sufficient contrast, colors that are two apart do not tend to look as good together. (The gist of it is that each pair of colors is roughly 6/11s of the way around the circle, which gives a lot of contrast, but then colors 1 and 3 are only 1/11 apart. I'm simplifying away phi / pi irrational fractions, but that's the upshot.)

You likely want to use a different coloring generation scheme that generates a wider variety of colors (shades/tints, as well as hues). I attempted something like this at https://pyret.slack.com/archives/C1E30822E/p1639246388000200, for what it's worth...

blerner avatar Feb 10 '22 18:02 blerner

Cool! This will take me some time to port over to CPO, but it's helpful to have a good place to start.

On the flip side - is this the kind of thing we'd want to expose from within CPO itself? Assuming the answer is no, but wanted to check since it's possible that other libraries might want something like this.

schanzer avatar Feb 10 '22 19:02 schanzer

No. I think this may be the sort of thing we'd like to have as a community-supplied library, but I don't think we need it to ever be "baked in" to CPO.

blerner avatar Feb 10 '22 19:02 blerner

2d color palette.txt

Adding your CPP file here for posterity. I've got some work ahead of me. :)

schanzer avatar Feb 10 '22 19:02 schanzer

not c++! it's TypeScript

blerner avatar Feb 10 '22 19:02 blerner

That's odd - when I downloaded the file it had a .cpp extension...

schanzer avatar Feb 10 '22 19:02 schanzer

@blerner our need for this is long gone, and we're the only ones who ever asked for it. OK to close?

schanzer avatar Jan 11 '24 15:01 schanzer