This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-08
Channels
- # announcements (9)
- # babashka (17)
- # beginners (26)
- # biff (2)
- # calva (5)
- # cider (11)
- # clara (6)
- # clojure (48)
- # clojure-europe (34)
- # clojure-nl (1)
- # clojure-norway (34)
- # clojure-uk (2)
- # clojurescript (22)
- # clr (11)
- # code-reviews (5)
- # conjure (3)
- # datomic (26)
- # emacs (14)
- # fulcro (10)
- # hyperfiddle (70)
- # lsp (34)
- # malli (5)
- # missionary (5)
- # off-topic (34)
- # releases (1)
- # shadow-cljs (19)
- # tree-sitter (1)
- # xtdb (25)
Does anyone have any experience dealing with colour scales? I have a theme of 5-6 colours that I prefer to use first, but I need to represent perhaps 20 more colours in certain cases in dynamically generated diagrams. Is there a way to generate these additional colours in such a way that they are evenly spaced out without resembling any of the preferred colours? I’m aware of both https://github.com/thi-ng/color and https://github.com/rm-hull/inkspot as potential libraries which may be of assistance.
If you have a maximum number of colors, I'd choose an appropriate color palette without any run-time scaling. E.g. D3 has "Category20" palette. You can probably find similar palettes that are large enough.
Ah, of course there's a relevant SE question: https://graphicdesign.stackexchange.com/questions/3682/where-can-i-find-a-large-palette-set-of-contrasting-colors-for-coloring-many-d
Ah. The problem with categories with no maximum is that at higher numbers the colors will invariably start to blend in. The problem becomes much worse if your product will be used by color-blind people. A solution that I used in one of the projects is to use a fixed palette of decent size suitable for color-blind people, and categories that wouldn't fit in there were represented with fill patterns. E.g. if the palette is of size 10 and the 1st color is red, then the 11th "color" would be red with black vertical stripes, 21st - horizontal, 31st - diagonal from top left to bottom right, 41st - from top right to bottom left, 51st - vertical and horizontal, and so on.
So the total size becomes 32 * color palette size, which was more than enough for my needs in that project.
Not sure how I can deal with all cases of colour blindness without completely sacrificing legibility
I think I'm gonna combine my 6 theme colours with a really long list of colours and filter away colours resembling the original theme using the colour distance function in thing/color.
There are some goodies in goog.color
https://google.github.io/closure-library/api/goog.color.html
I’ve had success generating palettes with those functions + some simple heuristics
http://thi.ng/color looks quite nice and complete. 🙂 goog.color makes sense if you wish to avoid an extra dep
Also, just in case - there's this thing: https://www.npmjs.com/package/color-hash Doesn't guarantee absence of clashing or close colors but can provide stable colors for the same categories regardless of their order.