Get the next color for the table / table?

I have a table / chart. And I add a series for them. Each series is identified by color.

I am looking for how to choose the best color for the series that I am adding to my series.

The goal is to have the next best color, depending on the colors already used. Since I can add / remove a series, I cannot just have an array of colors and take the next one on the list.

I heard that there was some kind of MS manual for this (found only this equivalent for excel )

Any idea / link / method for this?

EDIT: Found this one that provides interesting information about color contrast

EDIT2: I tried using the "Color Hue wheel": I only divide the wheel by the number of colors I need, and I take the color at the beginning of the position. I also included an offset method if we wanted to start with a different color.

It works, I have different colors, but I get the impression that we can do better. For instance. With an offset of 210 Β°, 6 colors, I have these colors: enter image description here I think this is just an optical illusion, but the last two colors seem closer than the others. The problem is that I have to deal with the user's eye.

The whole "shade" looks like this: enter image description here With the eye, we can see that there is some kind of color that looks like something more than another (for example, blue). For me, green seems to be more yellow ...

It seems like there is a concept of color perceived linear colors , do you know if there is an algorithm that allows me to get a perceptually linear color matrix? Then it will be easy to take the colors I need

+6
source share
2 answers

See How to automatically generate N "distinct" colors? but...

This is what I did when faced with a similar problem.

I created a table of 32 beautifully distributed and clear colors. I did it once. When I have to submit more than 32, I just repeat the colors. I decided that 32 separate episodes were more than good enough for my data set (I don’t know that more than 32 episodes were really used in a real life scenario).

An option for this is to change the color a little when you go to the size of the reference table using a gross change in adding 11111 to it.

I found this to be a very simple approach with few errors.

Most algorithms (all?) That take the number of colors needed and generate a list of different colors suffer from the problem of changing the colors of existing series when adding a new one, which I find as a blocker, since users usually expect the X series to be black and the Y series to yellow, etc., even if they add a new series.

0
source

Finally I finished measuring the distance between the colors. And only accept this if the distance is greater than the trigger.

To do this, I iterate over my HsvColor and then convert it to Rgb β†’ XYZ β†’ Lab (CIE L * a * b), which is a perceptually linear color scale. I based my code on this: http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CMC.html

0
source

Source: https://habr.com/ru/post/946926/


All Articles