Calculation of color tones

I have the following problem.
I have a base color with a pair of different shades of this color.

Example:

  • Main color: # 4085c5
  • Shadow: # 005cb1

Now I have a different color (say # d60620), but there are no shades of it. From the color, I would like to calculate shades that have a similar difference, like the colors mentioned in the first paragraph.

At first I tried to calculate the difference between the RGB elements and apply them to the second color, but the result was not what I expected. Than I tried to convert the color to HSV , indicating the saturation value and applying the difference to the second color, but again the resulting color was still strange.

The formula was something like this: (HSV (BaseColor) [S] - HSV (Shade) [S]) + HSV (SecondColor) [H]

Does anyone know how this problem can be solved? I know that I am doing something wrong, but I do not know what. :)

+4
source share
2 answers

There are two ways to darken color:

  • Subtract an equal amount from R, G, B. This increases saturation. Obviously, you can only subtract the mount equal to the smallest of the values ​​of R, G, B.
  • Multiply R, G, B by a value less than 1.0. This leaves the saturation more or less intact.

Similarly, there are two ways to lighten color:

  • Add an equal amount to R, G, B. This reduces saturation.
  • Multiply R, G, B by a value greater than 1.0. This increases the brightness of the color and, consequently, the apparent saturation.

Your example seems to have done both - subtracting 0x40 from each value and multiplying by 1.33.

Using your second color, we can subtract 06 from each result in # d0000a, but it's not dark enough. Multiplying by 0.735 results in # 990013.

enter image description here

+1
source

Your first two colors have an β€œH” (hue) value of 209 and different meanings for β€œS” and β€œV”.

This general shade is what defines the second color as the β€œshade" of the first color.

To find alternate hues for your third color, use the RGB to HSV conversion to find its hue, change its S and V values ​​as desired, and then convert it back to RGB.

+1
source

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


All Articles