如何混合特定数量的两种颜色

How to blend two colors a specific amount

那么你会如何混合两种颜色?

就像你输入 color1, color2amount, 所以如果 amount 为 0,则为 100% color1,如果 amount 为 1,则为 100% color2。介于两者之间的任何东西都是两者的混合。

你会怎么做?

Linear interpolation.

new_color_r = color1_r * (1 - amount) + color2_r * amount
new_color_g = color1_g * (1 - amount) + color2_g * amount
new_color_b = color1_b * (1 - amount) + color2_b * amount