1. 14
    1. 2

      Grah, non perceptually uniform rainbow brings pain! Big green center all looks same. Please consider perceptually uniform color space like OkLab https://bottosson.github.io/posts/oklab/

      Easy solution is downloading better rainbow from here https://colorcet.com/

      1. 1

        PRs/forks are welcome :)

        Too busy with kernel stuff to spend any time on this myself unfort! I agree the colour range looks weird to the eye, the implementation is very simplistic

    2. 2

      This is cool looking but I can’t tell what going on. Most sorting visualizations I’ve seen visualize the sort in 1d somehow… but this uses 2d and I cant tell how it maps onto the 1d sort.

      EDIT: It looks like it is a 1d array of colors that wraps from bottom to top, left to right. But I still don’t see how to apprehend the sorting logic – either I’m missing something or it’s just supposed to be pretty rather than instructive?

      1. 3

        It’s totally designed to be pretty more than instructive though I hope it does provide something of the latter.

        The issue with a 1d representation is it’s obviously quite limited in how much you can show, so the idea is you have a vertical 1d representation in each column that simply wraps to the next from red to blue. I think it does a good job of showing the piecemeal nature of selection sort and friends and the divide + conquer nature of qsort + heap sort so there are insights!

        It’s something I did years ago but updated for fun :) as part of that I improved the ‘fairness’ of it so different sorting algorithms sorting the same number of elements should reflect the ratio between the sorts in real life, which is a radical difference, so I think that is informative too.

        The UI is a little less intuitive on that, should maybe have a lock button but my main interest these days is kernel hacking so will probably say as is, a small folly!

        1. 2

          Thanks for the explanation. It is quite nice looking!

    3. 1

      ha I just realised that I did this nearly 10 years ago (but updated again more recently). Still, a fun hack! :)

    4. 1

      No radix sort alas :(

      1. 2

        Pull requests are welcome :) https://github.com/lorenzo-stoakes/rainbow-sort

        The code is, however, old and sketchy.

        1. 2

          Delightful! Thank you, I want to add merge sort. (Maybe somehow I’ll even do it.)

          CoffeeScript

          :thinking: ….how hard can it be?

          1. 1

            The code is less than… brilliant and I haven’t done web dev for many years now so I am sure anything you can think of will be superior to what already exists :P

            The most recent changes were somewhat hacked in but made the output ‘fair’ as before they didn’t all update at the same rates.

            You are also absolutely welcome to fork or do whatever you like with it if you’d enjoy that! It’s MIT so anybody is free to do whatever with it!