On Wednesday, March 20, 2019 at 10:35:51 AM UTC+8, Ben Greenman wrote: > > > Could you (or Ben or Matt) elaborate on how do you see this work for non > > plot programs? > > I'm thinking a color-map% object would define a possibly-infinite > sequence of colors that look nice in some way. The colors might be > useful anywhere where someone wants a "rainbow" of colors ... maybe > for: > > - fonts in a slideshow (colorblind-friendly? grayscale-friendly?), > - coloring the error messages made by a linter or program analyzer, > - drawing a sunset, etc. >
The examples listed above might be better served by other color choosing mechanisms, for example, I have implemented some color manipulation code based on https://tallys.github.io/color-theory/, you can find it here: https://github.com/alex-hhh/data-frame/blob/master/private/colors.rkt . In particular the `pick-color` function might do something similar to what Pyret is using (as suggested by Justin Zamora). Other solutions are also possible, including using gradient color maps, but this is a larger scope that I originally planned for and I don't have the time to prepare and submit a patch for such changes. My proposal is more limited, to allow plot users to produce good looking plots with minimum effort. What I propose is: (1) Add a mechanism (via parameters) to replace the `pen-colors` and `brush-colors` vectors in the plot package with custom defined colors. This means that the existing `->pen-color` and `->brush-color` functions would now return a different color depending on what `pen-colors` or `brush-colors` are installed. This also has the benefit that the existing mechanism of specifying numbers for colors will now work with color maps: (plot (list (function sin -5 5 #:color 1))) (2) "Borrow" the qualitative color maps from matplotlib, so the user has some nice predefined set of colors to choose from for their plots. Also, possibly the following backwards incompatible changes: (3) change the default set of `pen-colors` and `brush-colors` to one of the new color maps, so the nicer colors are on by default. (4) change the default plot behavior so that a different color is chosen for each renderer, this means that things like the code below would result in different colors used for the `sin` and `cos` functions: (plot (list (function sin -5 5) (function cos -5 5))) If others think that (1) and (2) are worthwhile doing, I will submit a PR, so we can discuss the API an implementation over something more concrete. I am open discussion for points (3) and (4). For the more broader color map changes, if the improvements are split up in small incremental tasks, I will be happy to help out, as time allows. Alex. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.