brownplt / code.pyret.org

Website for serving Pyret to folks.
Other
24 stars 45 forks source link

Expose the color-generator from error messages #422

Closed schanzer closed 9 months ago

schanzer commented 2 years ago

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)

blerner commented 2 years ago

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...

schanzer commented 2 years ago

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.

blerner commented 2 years ago

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.

schanzer commented 2 years ago

2d color palette.txt

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

blerner commented 2 years ago

not c++! it's TypeScript

schanzer commented 2 years ago

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

schanzer commented 9 months ago

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