R
R
Rifat2017-01-23 16:14:31
Design
Rifat, 2017-01-23 16:14:31

Formula for calculating color?

The input is an array of 7 colors of the rainbow.
How can you calculate the proportions of mixing colors to get a given one? For example, I want to get the color #617730, I need to calculate which of the 7 colors of the rainbow and in what proportions I need to mix.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yuri, 2017-01-23
@riky

to get any color, it is enough to have 3 RGB colors.
so
#617730 = #610000 + #007700 + #000030

E
evgeniy_lm, 2017-01-24
@evgeniy_lm

I think this article will help you

D
dom1n1k, 2017-01-23
@dom1n1k

The task is formulated too generally, you need to look at the specifics and details.
Depending on them, it can turn out to be both elementary (like Yuri 's answer ), and very complex things that go into science to the very top.

X
xmoonlight, 2017-01-23
@xmoonlight

R = R1 + (R2 - R1) * Blend / 255;
G = G1 + (G2 - G1) * Blend / 255;
B = B1 + (B2 - B1) * Blend / 255;
where Blend = 0..255 as transition values ​​from one color to another, 127 - mixed in half...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question